@fluidframework/container-loader 2.74.0-365691 → 2.74.0-370705

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.
@@ -1 +1 @@
1
- {"version":3,"file":"container.js","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,wDAAwD;AAExD,+DAIsC;AACtC,iFAI+C;AAoB/C,6EAAoF;AACpF,qEAMyC;AAEzC,kEAA6F;AAC7F,2EAO4C;AAC5C,0EAmBqD;AACrD,oEAS+C;AAC/C,uEAkBkD;AAClD,+EAAsD;AACtD,+BAAkC;AAElC,mDAIyB;AACzB,+CAAyC;AACzC,iEAA2D;AAC3D,6DAAuD;AACvD,2EAGqC;AACrC,+DAAyD;AACzD,6EAAuE;AACvE,iDAMwB;AACxB,uDAAuE;AAEvE,2CAA6C;AAC7C,2EAGqC;AACrC,iEAIgC;AAChC,yDAAmD;AACnD,2DAAiD;AAEjD,+CAMuB;AACvB,2CAA8D;AAC9D,2EAIqC;AACrC,yCAUoB;AAEpB,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAExC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AACpC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAEpC,MAAM,sBAAsB,GAAG,iDAAiD,CAAC;AAyCjF;;;;;;;;;;;;;;;;GAgBG;AACI,KAAK,UAAU,sBAAsB,CAAC,SAAqB;IACjE,oDAAoD;IACpD,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;QACtB,MAAM,IAAI,qBAAU,CAAC,0CAA0C,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC/C,MAAM,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC;QAE5C,MAAM,cAAc,GAAG,CAAC,GAAyC,EAAQ,EAAE;YAC1E,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,cAAc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AA0G;QAC1G,mDAAmD;QACnD,IAAA,iBAAM,EACL,IAAI,CAAC,MAAM,EACX,KAAK,CAAC,kEAAkE,CACxE,CAAC;QAEF,QAAQ,kBAAkB,EAAE,CAAC;YAC5B,KAAK,SAAS,CAAC,CAAC,CAAC;gBAChB,IAAI,cAAc,EAAE,CAAC;oBACpB,sDAAsD;oBACtD,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;gBAC3C,CAAC;YACF,CAAC;YACD,0BAA0B;YAC1B,KAAK,SAAS,CAAC,CAAC,CAAC;gBAChB,IAAA,iBAAM,EACL,IAAI,CAAC,0BAA0B,EAC/B,KAAK,CAAC,+CAA+C,CACrD,CAAC;gBACF,IAAI,CAAC,0BAA0B,GAAG,KAAK,CAAC;gBACxC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBACpC,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;gBAC1C,MAAM;YACP,CAAC;YACD,KAAK,MAAM,CAAC,CAAC,CAAC;gBACb,MAAM;YACP,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACT,IAAA,0BAAe,EAAC,kBAAkB,CAAC,CAAC;YACrC,CAAC;QACF,CAAC;IACF,CAAC;CACD;AAruED,8BAquEC;AAgBD;;;GAGG;AACH,SAAgB,aAAa,CAAC,IAAgB;IAC7C,OAAO,IAAsB,CAAC;AAC/B,CAAC;AAFD,sCAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable unicorn/consistent-function-scoping */\n\nimport {\n\tTypedEventEmitter,\n\tperformanceNow,\n\ttype ILayerCompatDetails,\n} from \"@fluid-internal/client-utils\";\nimport {\n\tAttachState,\n\ttype IAudience,\n\ttype ICriticalContainerError,\n} from \"@fluidframework/container-definitions\";\nimport type {\n\tContainerWarning,\n\tIBatchMessage,\n\tICodeDetailsLoader,\n\tIContainer,\n\tIContainerEvents,\n\tIContainerLoadMode,\n\tIDeltaManager,\n\tIFluidCodeDetails,\n\tIFluidCodeDetailsComparer,\n\tIFluidModuleWithDetails,\n\tIProvideFluidCodeDetailsComparer,\n\tIProvideRuntimeFactory,\n\tIRuntime,\n\tReadOnlyInfo,\n\tILoader,\n\tILoaderOptions,\n\tIContainerStorageService,\n} from \"@fluidframework/container-definitions/internal\";\nimport { isFluidCodeDetails } from \"@fluidframework/container-definitions/internal\";\nimport {\n\ttype FluidObject,\n\ttype IEvent,\n\ttype IRequest,\n\ttype ITelemetryBaseProperties,\n\tLogLevel,\n} from \"@fluidframework/core-interfaces\";\nimport type { ISignalEnvelope } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, isPromiseLike, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype IClient,\n\ttype IClientDetails,\n\ttype IQuorumClients,\n\ttype ISequencedClient,\n\ttype ISummaryTree,\n\tSummaryType,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\ttype IDocumentService,\n\ttype IDocumentServiceFactory,\n\ttype IResolvedUrl,\n\ttype ISnapshot,\n\ttype IThrottlingWarning,\n\ttype IUrlResolver,\n\ttype ICommittedProposal,\n\ttype IDocumentAttributes,\n\ttype IDocumentMessage,\n\ttype IQuorumProposals,\n\ttype ISequencedProposal,\n\ttype ISnapshotTree,\n\ttype ISummaryContent,\n\ttype IVersion,\n\tMessageType,\n\ttype ISequencedDocumentMessage,\n\ttype ISignalMessage,\n\ttype ConnectionMode,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tgetSnapshotTree,\n\tOnlineStatus,\n\tisCombinedAppAndProtocolSummary,\n\tisInstanceOfISnapshot,\n\tisOnline,\n\treadAndParse,\n\trunWithRetry,\n\ttype CombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype TelemetryEventCategory,\n\ttype ITelemetryLoggerExt,\n\tEventEmitterWithErrorHandling,\n\tGenericError,\n\ttype IFluidErrorBase,\n\ttype MonitoringContext,\n\tPerformanceEvent,\n\tUsageError,\n\tconnectedEventName,\n\tcreateChildLogger,\n\tcreateChildMonitoringContext,\n\tformatTick,\n\tnormalizeError,\n\traiseConnectedEvent,\n\twrapError,\n\tloggerToMonitoringContext,\n\ttype ITelemetryErrorEventExt,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport structuredClone from \"@ungap/structured-clone\";\nimport { v4 as uuid } from \"uuid\";\n\nimport {\n\ttype AttachProcessProps,\n\ttype AttachmentData,\n\trunRetriableAttachProcess,\n} from \"./attachment.js\";\nimport { Audience } from \"./audience.js\";\nimport { ConnectionManager } from \"./connectionManager.js\";\nimport { ConnectionState } from \"./connectionState.js\";\nimport {\n\ttype IConnectionStateHandler,\n\tcreateConnectionStateHandler,\n} from \"./connectionStateHandler.js\";\nimport { ContainerContext } from \"./containerContext.js\";\nimport { ContainerStorageAdapter } from \"./containerStorageAdapter.js\";\nimport {\n\ttype IConnectionDetailsInternal,\n\ttype IConnectionManagerFactoryArgs,\n\ttype IConnectionStateChangeReason,\n\tReconnectMode,\n\tgetPackageName,\n} from \"./contracts.js\";\nimport { DeltaManager, type IConnectionArgs } from \"./deltaManager.js\";\nimport type { ILoaderServices } from \"./loader.js\";\nimport { RelativeLoader } from \"./loader.js\";\nimport {\n\tvalidateDriverCompatibility,\n\tvalidateRuntimeCompatibility,\n} from \"./loaderLayerCompatState.js\";\nimport {\n\tcreateMemoryDetachedBlobStorage,\n\ttryInitializeMemoryDetachedBlobStorage,\n\ttype MemoryDetachedBlobStorage,\n} from \"./memoryBlobStorage.js\";\nimport { NoopHeuristic } from \"./noopHeuristic.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\nimport type { IQuorumSnapshot } from \"./protocol/index.js\";\nimport {\n\ttype InternalProtocolHandlerBuilder,\n\tProtocolHandler,\n\ttype ProtocolHandlerInternal,\n\tprotocolHandlerShouldProcessSignal,\n\twrapProtocolHandlerBuilder,\n} from \"./protocol.js\";\nimport { initQuorumValuesFromCodeDetails } from \"./quorum.js\";\nimport {\n\ttype IPendingContainerState,\n\ttype IPendingDetachedContainerState,\n\tSerializedStateManager,\n} from \"./serializedStateManager.js\";\nimport {\n\tcombineAppAndProtocolSummary,\n\tcombineSnapshotTreeAndSnapshotBlobs,\n\tgetDetachedContainerStateFromSerializedContainer,\n\tgetDocumentAttributes,\n\tgetProtocolSnapshotTree,\n\tgetISnapshotFromSerializedContainer,\n\trunSingle,\n\tconvertISnapshotToSnapshotWithBlobs,\n\tconvertSnapshotInfoToSnapshot,\n} from \"./utils.js\";\n\nconst detachedContainerRefSeqNumber = 0;\n\nconst dirtyContainerEvent = \"dirty\";\nconst savedContainerEvent = \"saved\";\n\nconst packageNotFactoryError = \"Code package does not implement IRuntimeFactory\";\n\n/**\n * @remarks Export for testing only\n * @internal\n */\nexport interface IContainerLoadProps {\n\t/**\n\t * The resolved url of the container being loaded\n\t */\n\treadonly resolvedUrl: IResolvedUrl;\n\t/**\n\t * Control which snapshot version to load from. See IParsedUrl for detailed information.\n\t */\n\treadonly version: string | undefined;\n\t/**\n\t * Loads the Container in paused state if true, unpaused otherwise.\n\t */\n\treadonly loadMode?: IContainerLoadMode;\n\n\t/**\n\t * The pending state serialized from a previous container instance\n\t */\n\treadonly pendingLocalState?: IPendingContainerState;\n}\n\n/**\n * @remarks Export for testing only\n * @internal\n */\nexport interface IContainerCreateProps extends ILoaderServices {\n\t/**\n\t * Disables the Container from reconnecting if false, allows reconnect otherwise.\n\t */\n\treadonly canReconnect?: boolean;\n\t/**\n\t * Client details provided in the override will be merged over the default client.\n\t */\n\treadonly clientDetailsOverride?: IClientDetails;\n}\n\n/**\n * Waits until container connects to delta storage and gets up-to-date.\n *\n * Useful when resolving URIs and hitting 404, due to container being loaded from (stale) snapshot and not being\n * up to date. Host may chose to wait in such case and retry resolving URI.\n *\n * Warning: Will wait infinitely for connection to establish if there is no connection.\n * May result in deadlock if Container.disconnect() is called and never followed by a call to Container.connect().\n *\n * @returns `true`: container is up to date, it processed all the ops that were know at the time of first connection.\n *\n * `false`: storage does not provide indication of how far the client is. Container processed all the ops known to it,\n * but it maybe still behind.\n *\n * @throws an error beginning with `\"Container closed\"` if the container is closed before it catches up.\n * @legacy @beta\n */\nexport async function waitContainerToCatchUp(container: IContainer): Promise<boolean> {\n\t// Make sure we stop waiting if container is closed.\n\tif (container.closed) {\n\t\tthrow new UsageError(\"waitContainerToCatchUp: Container closed\");\n\t}\n\n\treturn new Promise<boolean>((resolve, reject) => {\n\t\tconst deltaManager = container.deltaManager;\n\n\t\tconst closedCallback = (err?: ICriticalContainerError | undefined): void => {\n\t\t\tcontainer.off(\"closed\", closedCallback);\n\t\t\tconst baseMessage = \"Container closed while waiting to catch up\";\n\t\t\treject(\n\t\t\t\terr === undefined\n\t\t\t\t\t? new GenericError(baseMessage)\n\t\t\t\t\t: wrapError(\n\t\t\t\t\t\t\terr,\n\t\t\t\t\t\t\t(innerMessage) => new GenericError(`${baseMessage}: ${innerMessage}`),\n\t\t\t\t\t\t),\n\t\t\t);\n\t\t};\n\t\tcontainer.on(\"closed\", closedCallback);\n\n\t\t// Depending on config, transition to \"connected\" state may include the guarantee\n\t\t// that all known ops have been processed. If so, we may introduce additional wait here.\n\t\t// Waiting for \"connected\" state in either case gets us at least to our own Join op\n\t\t// which is a reasonable approximation of \"caught up\"\n\t\tconst waitForOps = (): void => {\n\t\t\tassert(\n\t\t\t\tcontainer.connectionState === ConnectionState.CatchingUp ||\n\t\t\t\t\tcontainer.connectionState === ConnectionState.Connected,\n\t\t\t\t0x0cd /* \"Container disconnected while waiting for ops!\" */,\n\t\t\t);\n\t\t\tconst hasCheckpointSequenceNumber = deltaManager.hasCheckpointSequenceNumber;\n\n\t\t\tconst connectionOpSeqNumber = deltaManager.lastKnownSeqNumber;\n\t\t\tassert(\n\t\t\t\tdeltaManager.lastSequenceNumber <= connectionOpSeqNumber,\n\t\t\t\t0x266 /* \"lastKnownSeqNumber should never be below last processed sequence number\" */,\n\t\t\t);\n\t\t\tif (deltaManager.lastSequenceNumber === connectionOpSeqNumber) {\n\t\t\t\tcontainer.off(\"closed\", closedCallback);\n\t\t\t\tresolve(hasCheckpointSequenceNumber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst callbackOps = (message: ISequencedDocumentMessage): void => {\n\t\t\t\tif (connectionOpSeqNumber <= message.sequenceNumber) {\n\t\t\t\t\tcontainer.off(\"closed\", closedCallback);\n\t\t\t\t\tresolve(hasCheckpointSequenceNumber);\n\t\t\t\t\tdeltaManager.off(\"op\", callbackOps);\n\t\t\t\t}\n\t\t\t};\n\t\t\tdeltaManager.on(\"op\", callbackOps);\n\t\t};\n\n\t\t// We can leverage DeltaManager's \"connect\" event here and test for ConnectionState.Disconnected\n\t\t// But that works only if service provides us checkPointSequenceNumber\n\t\t// Our internal testing is based on R11S that does not, but almost all tests connect as \"write\" and\n\t\t// use this function to catch up, so leveraging our own join op as a fence/barrier\n\t\tif (container.connectionState === ConnectionState.Connected) {\n\t\t\twaitForOps();\n\t\t\treturn;\n\t\t}\n\n\t\tconst callback = (): void => {\n\t\t\tcontainer.off(connectedEventName, callback);\n\t\t\twaitForOps();\n\t\t};\n\t\tcontainer.on(connectedEventName, callback);\n\n\t\tif (container.connectionState === ConnectionState.Disconnected) {\n\t\t\tcontainer.connect();\n\t\t}\n\t});\n}\n\nconst getCodeProposal = (quorum: IQuorumProposals): unknown =>\n\tquorum.get(\"code\") ?? quorum.get(\"code2\");\n\n/**\n * Helper function to report to telemetry cases where operation takes longer than expected (200ms)\n * @param logger - logger to use\n * @param eventName - event name\n * @param action - functor to call and measure\n */\nexport async function ReportIfTooLong(\n\tlogger: ITelemetryLoggerExt,\n\teventName: string,\n\taction: () => Promise<ITelemetryBaseProperties>,\n): Promise<void> {\n\tconst event = PerformanceEvent.start(logger, { eventName });\n\tconst props = await action();\n\tif (event.duration > 200) {\n\t\tevent.end(props);\n\t}\n}\n\nconst summarizerClientType = \"summarizer\";\n\ninterface IContainerLifecycleEvents extends IEvent {\n\t(event: \"runtimeInstantiated\", listener: () => void): void;\n\t(event: \"disposed\", listener: () => void): void;\n}\n\nexport class Container\n\textends EventEmitterWithErrorHandling<IContainerEvents>\n\timplements IContainer, ContainerAlpha\n{\n\t/**\n\t * Load an existing container.\n\t */\n\tpublic static async load(\n\t\tloadProps: IContainerLoadProps,\n\t\tcreateProps: IContainerCreateProps,\n\t): Promise<Container> {\n\t\tconst { version, pendingLocalState, loadMode, resolvedUrl } = loadProps;\n\n\t\tconst container = new Container(createProps, loadProps);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tcontainer.mc.logger,\n\t\t\t{ eventName: \"Load\", ...loadMode },\n\t\t\tasync (event) =>\n\t\t\t\tnew Promise<Container>((resolve, reject) => {\n\t\t\t\t\tconst defaultMode: IContainerLoadMode = { opsBeforeReturn: \"cached\" };\n\t\t\t\t\t// if we have pendingLocalState, anything we cached is not useful and we shouldn't wait for connection\n\t\t\t\t\t// to return container, so ignore this value and use undefined for opsBeforeReturn\n\t\t\t\t\tconst mode: IContainerLoadMode = pendingLocalState\n\t\t\t\t\t\t? { ...(loadMode ?? defaultMode), opsBeforeReturn: undefined }\n\t\t\t\t\t\t: (loadMode ?? defaultMode);\n\n\t\t\t\t\tconst onClosed = (err?: ICriticalContainerError): void => {\n\t\t\t\t\t\t// pre-0.58 error message: containerClosedWithoutErrorDuringLoad\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\t\t\treject(err ?? new GenericError(\"Container closed without error during load\"));\n\t\t\t\t\t};\n\t\t\t\t\tcontainer.on(\"closed\", onClosed);\n\n\t\t\t\t\tcontainer\n\t\t\t\t\t\t.load(version, mode, resolvedUrl, pendingLocalState)\n\t\t\t\t\t\t.finally(() => {\n\t\t\t\t\t\t\tcontainer.removeListener(\"closed\", onClosed);\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.then(\n\t\t\t\t\t\t\t(props) => {\n\t\t\t\t\t\t\t\tevent.end({ ...props });\n\t\t\t\t\t\t\t\tresolve(container);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t(error) => {\n\t\t\t\t\t\t\t\tconst err = normalizeError(error);\n\t\t\t\t\t\t\t\t// Depending where error happens, we can be attempting to connect to web socket\n\t\t\t\t\t\t\t\t// and continuously retrying (consider offline mode)\n\t\t\t\t\t\t\t\t// Host has no container to close, so it's prudent to do it here\n\t\t\t\t\t\t\t\t// Note: We could only dispose the container instead of just close but that would\n\t\t\t\t\t\t\t\t// the telemetry where users sometimes search for ContainerClose event to look\n\t\t\t\t\t\t\t\t// for load failures. So not removing this at this time.\n\t\t\t\t\t\t\t\tcontainer.close(err);\n\t\t\t\t\t\t\t\tcontainer.dispose(err);\n\t\t\t\t\t\t\t\tonClosed(err);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t);\n\t\t\t\t}),\n\t\t\t{ start: true, end: true, cancel: \"generic\" },\n\t\t);\n\t}\n\n\t/**\n\t * Create a new container in a detached state.\n\t */\n\tpublic static async createDetached(\n\t\tcreateProps: IContainerCreateProps,\n\t\tcodeDetails: IFluidCodeDetails,\n\t): Promise<Container> {\n\t\tconst container = new Container(createProps);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tcontainer.mc.logger,\n\t\t\t{ eventName: \"CreateDetached\" },\n\t\t\tasync (_event) => {\n\t\t\t\tawait container.createDetached(codeDetails);\n\t\t\t\treturn container;\n\t\t\t},\n\t\t\t{ start: true, end: true, cancel: \"generic\" },\n\t\t);\n\t}\n\n\t/**\n\t * Create a new container in a detached state that is initialized with a\n\t * snapshot from a previous detached container.\n\t * @param createProps - Config options for this new container instance\n\t * @param snapshot - A stringified {@link IPendingDetachedContainerState}, e.g. generated via {@link serialize}\n\t */\n\tpublic static async rehydrateDetachedFromSnapshot(\n\t\tcreateProps: IContainerCreateProps,\n\t\tsnapshot: string,\n\t): Promise<Container> {\n\t\tconst container = new Container(createProps);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tcontainer.mc.logger,\n\t\t\t{ eventName: \"RehydrateDetachedFromSnapshot\" },\n\t\t\tasync (_event) => {\n\t\t\t\tconst detachedContainerState: IPendingDetachedContainerState =\n\t\t\t\t\tgetDetachedContainerStateFromSerializedContainer(snapshot);\n\t\t\t\tawait container.rehydrateDetachedFromSnapshot(detachedContainerState);\n\t\t\t\treturn container;\n\t\t\t},\n\t\t\t{ start: true, end: true, cancel: \"generic\" },\n\t\t);\n\t}\n\n\t// Tells if container can reconnect on losing fist connection\n\t// If false, container gets closed on loss of connection.\n\tprivate readonly _canReconnect: boolean;\n\tprivate readonly clientDetailsOverride: IClientDetails | undefined;\n\tprivate readonly urlResolver: IUrlResolver;\n\tprivate readonly serviceFactory: IDocumentServiceFactory;\n\tprivate readonly codeLoader: ICodeDetailsLoader;\n\tprivate readonly options: ILoaderOptions;\n\tprivate readonly scope: FluidObject;\n\tprivate readonly subLogger: ITelemetryLoggerExt;\n\tprivate readonly detachedBlobStorage: MemoryDetachedBlobStorage | undefined;\n\tprivate readonly protocolHandlerBuilder: InternalProtocolHandlerBuilder;\n\tprivate readonly signalAudience = new Audience();\n\tprivate readonly client: IClient;\n\n\tprivate readonly mc: MonitoringContext;\n\n\t/**\n\t * Used by the RelativeLoader to spawn a new Container for the same document. Used to create the summarizing client.\n\t */\n\tpublic readonly clone: (\n\t\tloadProps: IContainerLoadProps,\n\t\tcreateParamOverrides: Partial<IContainerCreateProps>,\n\t) => Promise<Container>;\n\n\t/**\n\t * Lifecycle state of the container, used mainly to prevent re-entrancy and telemetry\n\t *\n\t * States are allowed to progress to further states:\n\t * \"loading\" - \"loaded\" - \"closing\" - \"disposing\" - \"closed\" - \"disposed\"\n\t *\n\t * For example, moving from \"closed\" to \"disposing\" is not allowed since it is an earlier state.\n\t *\n\t * loading: Container has been created, but is not yet in normal/loaded state\n\t * loaded: Container is in normal/loaded state\n\t * closing: Container has started closing process (for re-entrancy prevention)\n\t * disposing: Container has started disposing process (for re-entrancy prevention)\n\t * closed: Container has closed\n\t * disposed: Container has been disposed\n\t */\n\tprivate _lifecycleState:\n\t\t| \"loading\"\n\t\t| \"loaded\"\n\t\t| \"closing\"\n\t\t| \"disposing\"\n\t\t| \"closed\"\n\t\t| \"disposed\" = \"loading\";\n\n\tprivate setLoaded(): void {\n\t\t// It's conceivable the container could be closed when this is called\n\t\t// Only transition states if currently loading\n\t\tif (this._lifecycleState === \"loading\") {\n\t\t\tthis._lifecycleState = \"loaded\";\n\n\t\t\t// Connections transitions are delayed till we are loaded.\n\t\t\t// This is done by holding ops and signals until the end of load sequence\n\t\t\t// (calling this.handleDeltaConnectionArg() after setLoaded() call)\n\t\t\t// If this assert fires, it means our logic managing connection flow is wrong, and the logic below is also wrong.\n\t\t\tassert(\n\t\t\t\tthis.connectionState !== ConnectionState.Connected,\n\t\t\t\t0x969 /* not connected yet */,\n\t\t\t);\n\n\t\t\t// Track membership changes and update connection state accordingly\n\t\t\t// We do this call here, instead of doing it in initializeProtocolState() due to pendingLocalState.\n\t\t\t// When we load from stashed state, we let connectionStateHandler know about clientId from previous container instance.\n\t\t\t// But we will play trailing ops from snapshot, including potentially playing join & leave ops for that same clientId!\n\t\t\t// In other words, if connectionStateHandler has access to Quorum early in load sequence, it will see events (in stashed ops mode)\n\t\t\t// in the order that is not possible in real life, that it may not expect.\n\t\t\t// Ideally, we should supply pendingLocalState?.clientId here as well, not in constructor, but it does not matter (at least today)\n\t\t\tthis.connectionStateHandler.initProtocol(this.protocolHandler);\n\n\t\t\t// This call does not look like needed any more, with delaying all connection-related events past loaded phase.\n\t\t\t// Yet, there could be some customer code that would break if we do not deliver it.\n\t\t\t// Will be removed in further PRs with proper changeset.\n\t\t\tconst runtime = this._runtime;\n\t\t\tif (\n\t\t\t\truntime !== undefined &&\n\t\t\t\t// Check for older runtime that may need this call\n\t\t\t\t!(\"setConnectionStatus\" in runtime) &&\n\t\t\t\truntime.disposed === false\n\t\t\t) {\n\t\t\t\truntime.setConnectionState(false /* canSendOps */, this.clientId);\n\t\t\t}\n\n\t\t\t// Deliver delayed calls to DeltaManager - we ignored \"connect\" events while loading.\n\t\t\tconst cm = this._deltaManager.connectionManager;\n\t\t\tif (cm.connected) {\n\t\t\t\tconst details = cm.connectionDetails;\n\t\t\t\tassert(details !== undefined, 0x96a /* should have details if connected */);\n\t\t\t\tthis.connectionStateHandler.receivedConnectEvent(details);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic get closed(): boolean {\n\t\treturn (\n\t\t\tthis._lifecycleState === \"closing\" || this._lifecycleState === \"closed\" || this.disposed\n\t\t);\n\t}\n\n\tprotected get loaded(): boolean {\n\t\treturn this._lifecycleState === \"loaded\";\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this._lifecycleState === \"disposing\" || this._lifecycleState === \"disposed\";\n\t}\n\n\tprivate readonly storageAdapter: ContainerStorageAdapter;\n\n\tprivate readonly _deltaManager: DeltaManager<ConnectionManager>;\n\tprivate service: IDocumentService | undefined;\n\n\tprivate _runtime: IRuntime | undefined;\n\tprivate get runtime(): IRuntime {\n\t\tif (this._runtime === undefined) {\n\t\t\tthrow new Error(\"Attempted to access runtime before it was defined\");\n\t\t}\n\t\treturn this._runtime;\n\t}\n\tprivate _protocolHandler: ProtocolHandlerInternal | undefined;\n\tprivate get protocolHandler(): ProtocolHandlerInternal {\n\t\tif (this._protocolHandler === undefined) {\n\t\t\tthrow new Error(\"Attempted to access protocolHandler before it was defined\");\n\t\t}\n\t\treturn this._protocolHandler;\n\t}\n\n\t/**\n\t * During initialization we pause the inbound queues. We track this state to ensure we only call resume once\n\t */\n\tprivate inboundQueuePausedFromInit = true;\n\tprivate connectionCount = 0;\n\tprivate readonly connectionTransitionTimes: number[] = [];\n\tprivate _loadedFromVersion: IVersion | undefined;\n\tprivate _dirtyContainer = false;\n\tprivate attachmentData: AttachmentData = { state: AttachState.Detached };\n\tprivate readonly serializedStateManager: SerializedStateManager;\n\tprivate readonly _containerId: string;\n\n\tprivate lastVisible: number | undefined;\n\tprivate readonly visibilityEventHandler: (() => void) | undefined;\n\tprivate readonly connectionStateHandler: IConnectionStateHandler;\n\tprivate readonly clientsWhoShouldHaveLeft = new Set<string>();\n\tprivate _containerMetadata: Readonly<Record<string, string>> = {};\n\n\tprivate setAutoReconnectTime = performanceNow();\n\n\tprivate noopHeuristic: NoopHeuristic | undefined;\n\n\tprivate get connectionMode(): ConnectionMode {\n\t\treturn this._deltaManager.connectionManager.connectionMode;\n\t}\n\n\tpublic get resolvedUrl(): IResolvedUrl | undefined {\n\t\t/**\n\t\t * All attached containers will have a document service,\n\t\t * this is required, as attached containers are attached to\n\t\t * a service. Detached containers will neither have a document\n\t\t * service or a resolved url as they only exist locally.\n\t\t * in order to create a document service a resolved url must\n\t\t * first be obtained, this is how the container is identified.\n\t\t * Because of this, the document service's resolved url\n\t\t * is always the same as the containers, as we had to\n\t\t * obtain the resolved url, and then create the service from it.\n\t\t */\n\t\treturn this.service?.resolvedUrl;\n\t}\n\n\tpublic get readOnlyInfo(): ReadOnlyInfo {\n\t\treturn this._deltaManager.readOnlyInfo;\n\t}\n\n\tpublic get containerMetadata(): Record<string, string> {\n\t\treturn this._containerMetadata;\n\t}\n\n\t/**\n\t * Sends signal to runtime (and data stores) to be read-only.\n\t * Hosts may have read only views, indicating to data stores that no edits are allowed.\n\t * This is independent from this._readonlyPermissions (permissions) and this.connectionMode\n\t * (server can return \"write\" mode even when asked for \"read\")\n\t * Leveraging same \"readonly\" event as runtime & data stores should behave the same in such case\n\t * as in read-only permissions.\n\t * But this.active can be used by some DDSes to figure out if ops can be sent\n\t * (for example, read-only view still participates in code proposals / upgrades decisions)\n\t *\n\t * Forcing Readonly does not prevent DDS from generating ops. It is up to user code to honour\n\t * the readonly flag. If ops are generated, they will accumulate locally and not be sent. If\n\t * there are pending in the outbound queue, it will stop sending until force readonly is\n\t * cleared.\n\t *\n\t * @param readonly - set or clear force readonly.\n\t */\n\tpublic forceReadonly(readonly: boolean): void {\n\t\tthis._deltaManager.connectionManager.forceReadonly(readonly);\n\t}\n\n\tpublic get deltaManager(): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n\t\treturn this._deltaManager;\n\t}\n\n\tpublic get connectionState(): ConnectionState {\n\t\treturn this.connectionStateHandler.connectionState;\n\t}\n\n\tprivate get connected(): boolean {\n\t\treturn this.connectionStateHandler.connectionState === ConnectionState.Connected;\n\t}\n\n\t/**\n\t * clientId of the latest connection. Changes only once client is connected, caught up and fully loaded.\n\t * Changes to clientId are delayed through container loading sequence and delived once container is fully loaded.\n\t * clientId does not reset on lost connection - old value persists until new connection is fully established.\n\t */\n\tpublic get clientId(): string | undefined {\n\t\treturn this.protocolHandler.audience.getSelf()?.clientId;\n\t}\n\n\tprivate get isInteractiveClient(): boolean {\n\t\treturn this.deltaManager.clientDetails.capabilities.interactive;\n\t}\n\n\tprivate supportGetSnapshotApi(): boolean {\n\t\tconst supportGetSnapshotApi: boolean =\n\t\t\tthis.mc.config.getBoolean(\"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2\") ===\n\t\t\t\ttrue && this.service?.policies?.supportGetSnapshotApi === true;\n\t\treturn supportGetSnapshotApi;\n\t}\n\n\t/**\n\t * Get the code details that are currently specified for the container.\n\t * @returns The current code details if any are specified, undefined if none are specified.\n\t */\n\tpublic getSpecifiedCodeDetails(): IFluidCodeDetails | undefined {\n\t\treturn this.getCodeDetailsFromQuorum();\n\t}\n\n\tprivate _loadedCodeDetails: IFluidCodeDetails | undefined;\n\t/**\n\t * Get the code details that were used to load the container.\n\t * @returns The code details that were used to load the container if it is loaded, undefined if it is not yet\n\t * loaded.\n\t */\n\tpublic getLoadedCodeDetails(): IFluidCodeDetails | undefined {\n\t\treturn this._loadedCodeDetails;\n\t}\n\n\tprivate _loadedModule: IFluidModuleWithDetails | undefined;\n\n\t/**\n\t * Retrieves the audience associated with the document\n\t */\n\tpublic get audience(): IAudience {\n\t\treturn this.protocolHandler.audience;\n\t}\n\n\t/**\n\t * Returns true if container is dirty.\n\t * Which means data loss if container is closed at that same moment\n\t * Most likely that happens when there is no network connection to Relay Service\n\t */\n\tpublic get isDirty(): boolean {\n\t\treturn this._dirtyContainer;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/container-definitions#IContainer.entryPoint}\n\t */\n\tpublic async getEntryPoint(): Promise<FluidObject> {\n\t\tif (this._disposed) {\n\t\t\tthrow new UsageError(\"The context is already disposed\");\n\t\t}\n\t\tif (this._runtime !== undefined) {\n\t\t\treturn this._runtime.getEntryPoint?.();\n\t\t}\n\t\treturn new Promise<FluidObject>((resolve, reject) => {\n\t\t\tconst runtimeInstantiatedHandler = (): void => {\n\t\t\t\tassert(\n\t\t\t\t\tthis._runtime !== undefined,\n\t\t\t\t\t0x5a3 /* runtimeInstantiated fired but runtime is still undefined */,\n\t\t\t\t);\n\t\t\t\tresolve(this._runtime.getEntryPoint?.());\n\t\t\t\tthis._lifecycleEvents.off(\"disposed\", disposedHandler);\n\t\t\t};\n\t\t\tconst disposedHandler = (): void => {\n\t\t\t\treject(new Error(\"ContainerContext was disposed\"));\n\t\t\t\tthis._lifecycleEvents.off(\"runtimeInstantiated\", runtimeInstantiatedHandler);\n\t\t\t};\n\t\t\tthis._lifecycleEvents.once(\"runtimeInstantiated\", runtimeInstantiatedHandler);\n\t\t\tthis._lifecycleEvents.once(\"disposed\", disposedHandler);\n\t\t});\n\t}\n\n\tprivate readonly _lifecycleEvents = new TypedEventEmitter<IContainerLifecycleEvents>();\n\n\tconstructor(\n\t\tcreateProps: IContainerCreateProps,\n\t\tloadProps?: Pick<IContainerLoadProps, \"pendingLocalState\">,\n\t) {\n\t\tsuper((name, error) => {\n\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"ContainerEventHandlerException\",\n\t\t\t\t\tname: typeof name === \"string\" ? name : undefined,\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t\tthis.close(normalizeError(error));\n\t\t});\n\n\t\tconst {\n\t\t\tcanReconnect,\n\t\t\tclientDetailsOverride,\n\t\t\turlResolver,\n\t\t\tdocumentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\toptions,\n\t\t\tscope,\n\t\t\tsubLogger,\n\t\t\tprotocolHandlerBuilder,\n\t\t} = createProps;\n\n\t\t// Validate that the Driver is compatible with this Loader.\n\t\tconst maybeDriverCompatDetails =\n\t\t\tdocumentServiceFactory as FluidObject<ILayerCompatDetails>;\n\t\tvalidateDriverCompatibility(\n\t\t\tmaybeDriverCompatDetails.ILayerCompatDetails,\n\t\t\t(error) => {} /* disposeFn */, // There is nothing to dispose here, so just ignore the error.\n\t\t\tsubLogger,\n\t\t);\n\n\t\tthis.connectionTransitionTimes[ConnectionState.Disconnected] = performanceNow();\n\t\tconst pendingLocalState = loadProps?.pendingLocalState;\n\n\t\tthis._canReconnect = canReconnect ?? true;\n\t\tthis.clientDetailsOverride = clientDetailsOverride;\n\t\tthis.urlResolver = urlResolver;\n\t\tthis.serviceFactory = documentServiceFactory;\n\t\tthis.codeLoader = codeLoader;\n\t\t// Warning: this is only a shallow clone. Mutation of any individual loader option will mutate it for\n\t\t// all clients that were loaded from the same loader (including summarizer clients).\n\t\t// Tracking alternative ways to handle this in AB#4129.\n\t\tthis.options = { ...options };\n\t\tthis.scope = scope;\n\t\tthis.protocolHandlerBuilder = wrapProtocolHandlerBuilder(\n\t\t\tprotocolHandlerBuilder ??\n\t\t\t\t((\n\t\t\t\t\tattributes: IDocumentAttributes,\n\t\t\t\t\tquorumSnapshot: IQuorumSnapshot,\n\t\t\t\t\tsendProposal: (key: string, value: unknown) => number,\n\t\t\t\t): ProtocolHandlerInternal =>\n\t\t\t\t\tnew ProtocolHandler(\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t\tquorumSnapshot,\n\t\t\t\t\t\tsendProposal,\n\t\t\t\t\t\tnew Audience(),\n\t\t\t\t\t\t(clientId: string) => this.clientsWhoShouldHaveLeft.has(clientId),\n\t\t\t\t\t)),\n\t\t\tthis.signalAudience,\n\t\t);\n\n\t\t// Note that we capture the createProps here so we can replicate the creation call when we want to clone.\n\t\tthis.clone = async (\n\t\t\t_loadProps: IContainerLoadProps,\n\t\t\tcreateParamOverrides: Partial<IContainerCreateProps>,\n\t\t): Promise<Container> => {\n\t\t\treturn Container.load(_loadProps, {\n\t\t\t\t...createProps,\n\t\t\t\t...createParamOverrides,\n\t\t\t});\n\t\t};\n\n\t\tthis._containerId = uuid();\n\n\t\tthis.client = Container.setupClient(\n\t\t\tthis._containerId,\n\t\t\toptions.client,\n\t\t\tthis.clientDetailsOverride,\n\t\t);\n\n\t\t// Create logger for data stores to use\n\t\tconst type = this.client.details.type;\n\t\tconst interactive = this.client.details.capabilities.interactive;\n\t\tconst clientType = `${interactive ? \"interactive\" : \"noninteractive\"}${\n\t\t\ttype !== undefined && type !== \"\" ? `/${type}` : \"\"\n\t\t}`;\n\n\t\t// Need to use the property getter for docId because for detached flow we don't have the docId initially.\n\t\t// We assign the id later so property getter is used.\n\t\tthis.subLogger = createChildLogger({\n\t\t\tlogger: subLogger,\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\tclientType, // Differentiating summarizer container from main container\n\t\t\t\t\tcontainerId: this._containerId,\n\t\t\t\t\tdocId: () => this.resolvedUrl?.id,\n\t\t\t\t\tcontainerAttachState: () => this.attachState,\n\t\t\t\t\tcontainerLifecycleState: () => this._lifecycleState,\n\t\t\t\t\tcontainerConnectionState: () => ConnectionState[this.connectionState],\n\t\t\t\t\tserializedContainer: pendingLocalState !== undefined,\n\t\t\t\t},\n\t\t\t\t// we need to be judicious with our logging here to avoid generating too much data\n\t\t\t\t// all data logged here should be broadly applicable, and not specific to a\n\t\t\t\t// specific error or class of errors\n\t\t\t\terror: {\n\t\t\t\t\t// load information to associate errors with the specific load point\n\t\t\t\t\tdmInitialSeqNumber: () => this._deltaManager?.initialSequenceNumber,\n\t\t\t\t\tdmLastProcessedSeqNumber: () => this._deltaManager?.lastSequenceNumber,\n\t\t\t\t\tdmLastKnownSeqNumber: () => this._deltaManager?.lastKnownSeqNumber,\n\t\t\t\t\tcontainerLoadedFromVersionId: () => this._loadedFromVersion?.id,\n\t\t\t\t\tcontainerLoadedFromVersionDate: () => this._loadedFromVersion?.date,\n\t\t\t\t\t// message information to associate errors with the specific execution state\n\t\t\t\t\t// dmLastMsqSeqNumber: if present, same as dmLastProcessedSeqNumber\n\t\t\t\t\tdmLastMsqSeqNumber: () => this.deltaManager?.lastMessage?.sequenceNumber,\n\t\t\t\t\tdmLastMsqSeqTimestamp: () => this.deltaManager?.lastMessage?.timestamp,\n\t\t\t\t\tdmLastMsqSeqClientId: () =>\n\t\t\t\t\t\tthis.deltaManager?.lastMessage?.clientId === null\n\t\t\t\t\t\t\t? \"null\"\n\t\t\t\t\t\t\t: this.deltaManager?.lastMessage?.clientId,\n\t\t\t\t\tdmLastMsgClientSeq: () => this.deltaManager?.lastMessage?.clientSequenceNumber,\n\t\t\t\t\tconnectionStateDuration: () =>\n\t\t\t\t\t\tperformanceNow() - this.connectionTransitionTimes[this.connectionState],\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\t// Prefix all events in this file with container-loader\n\t\tthis.mc = createChildMonitoringContext({ logger: this.subLogger, namespace: \"Container\" });\n\n\t\tthis._deltaManager = this.createDeltaManager();\n\n\t\tthis.connectionStateHandler = createConnectionStateHandler(\n\t\t\t{\n\t\t\t\tlogger: this.mc.logger,\n\t\t\t\t// WARNING: logger on this context should not including getters like containerConnectionState above (on this.subLogger),\n\t\t\t\t// as that will result in attempt to dereference this.connectionStateHandler from this call while it's still undefined.\n\t\t\t\tmc: loggerToMonitoringContext(subLogger),\n\t\t\t\tconnectionStateChanged: (value, oldState, reason) => {\n\t\t\t\t\tthis.logConnectionStateChangeTelemetry(value, oldState, reason);\n\t\t\t\t\tif (this.loaded) {\n\t\t\t\t\t\tthis.propagateConnectionState(\n\t\t\t\t\t\t\tvalue === ConnectionState.Disconnected\n\t\t\t\t\t\t\t\t? reason\n\t\t\t\t\t\t\t\t: undefined /* disconnectedReason */,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tshouldClientJoinWrite: () => this._deltaManager.connectionManager.shouldJoinWrite(),\n\t\t\t\tmaxClientLeaveWaitTime: options.maxClientLeaveWaitTime,\n\t\t\t\tlogConnectionIssue: (\n\t\t\t\t\teventName: string,\n\t\t\t\t\tcategory: TelemetryEventCategory,\n\t\t\t\t\tdetails?: ITelemetryBaseProperties,\n\t\t\t\t) => {\n\t\t\t\t\tconst mode = this.connectionMode;\n\t\t\t\t\t// We get here when socket does not receive any ops on \"write\" connection, including\n\t\t\t\t\t// its own join op.\n\t\t\t\t\t// Report issues only if we already loaded container - op processing is paused while container is loading,\n\t\t\t\t\t// so we always time-out processing of join op in cases where fetching snapshot takes a minute.\n\t\t\t\t\t// It's not a problem with op processing itself - such issues should be tracked as part of boot perf monitoring instead.\n\t\t\t\t\tthis._deltaManager.logConnectionIssue({\n\t\t\t\t\t\teventName,\n\t\t\t\t\t\tmode,\n\t\t\t\t\t\tcategory: this._lifecycleState === \"loading\" ? \"generic\" : category,\n\t\t\t\t\t\tduration:\n\t\t\t\t\t\t\tperformanceNow() - this.connectionTransitionTimes[ConnectionState.CatchingUp],\n\t\t\t\t\t\t...(details === undefined ? {} : { details: JSON.stringify(details) }),\n\t\t\t\t\t});\n\n\t\t\t\t\t// This assert is important for many reasons:\n\t\t\t\t\t// 1) Cosmetic / OCE burden: It's useless to raise NoJoinOp error events, if we are loading, as that's most\n\t\t\t\t\t// likely to happen if snapshot loading takes too long. During this time we are not processing ops so there is no\n\t\t\t\t\t// way to move to \"connected\" state, and thus \"NoJoin\" timer would fire (see\n\t\t\t\t\t// IConnectionStateHandler.logConnectionIssue() callback and related code in ConnectStateHandler class implementation).\n\t\t\t\t\t// But these events do not tell us anything about connectivity pipeline / op processing pipeline,\n\t\t\t\t\t// only that boot is slow, and we have events for that.\n\t\t\t\t\t// 2) Doing recovery below is useless in loading mode, for the reasons described above. At the same time we can't\n\t\t\t\t\t// not do it, as maybe we lost JoinSignal for \"self\", and when loading is done, we never move to connected\n\t\t\t\t\t// state. So we would have to do (in most cases) useless infinite reconnect loop while we are loading.\n\t\t\t\t\tassert(\n\t\t\t\t\t\tthis.loaded,\n\t\t\t\t\t\t0x96b /* connection issues can be raised only after container is loaded */,\n\t\t\t\t\t);\n\n\t\t\t\t\t// If this is \"write\" connection, it took too long to receive join op. But in most cases that's due\n\t\t\t\t\t// to very slow op fetches and we will eventually get there.\n\t\t\t\t\t// For \"read\" connections, we get here due to join signal for \"self\" not arriving on time.\n\t\t\t\t\t// Attempt to recover by reconnecting.\n\t\t\t\t\tif (mode === \"read\" && category === \"error\") {\n\t\t\t\t\t\tconst reason = { text: \"NoJoinSignal\" };\n\t\t\t\t\t\tthis.disconnectInternal(reason);\n\t\t\t\t\t\tthis.connectInternal({ reason, fetchOpsFromStorage: false });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tclientShouldHaveLeft: (clientId: string) => {\n\t\t\t\t\tthis.clientsWhoShouldHaveLeft.add(clientId);\n\t\t\t\t},\n\t\t\t\tonCriticalError: (error: unknown) => {\n\t\t\t\t\tthis.close(normalizeError(error));\n\t\t\t\t},\n\t\t\t},\n\t\t\tthis.deltaManager,\n\t\t\tpendingLocalState?.clientId,\n\t\t);\n\n\t\tthis.on(savedContainerEvent, () => {\n\t\t\tthis.connectionStateHandler.containerSaved();\n\t\t});\n\n\t\t// We expose our storage publicly, so it's possible others may call uploadSummaryWithContext() with a\n\t\t// non-combined summary tree (in particular, ContainerRuntime.submitSummary). We'll intercept those calls\n\t\t// using this callback and fix them up.\n\t\tconst addProtocolSummaryIfMissing = (\n\t\t\tsummaryTree: ISummaryTree,\n\t\t): CombinedAppAndProtocolSummary =>\n\t\t\tisCombinedAppAndProtocolSummary(summaryTree) === true\n\t\t\t\t? summaryTree\n\t\t\t\t: combineAppAndProtocolSummary(summaryTree, this.captureProtocolSummary());\n\n\t\t// Feature gate to enable single-commit summaries. The expected enablement is through driver layer's policies,\n\t\t// but here we also specify config setting to use for testing purposes.\n\t\tconst enableSummarizeProtocolTree = this.mc.config.getBoolean(\n\t\t\t\"Fluid.Container.summarizeProtocolTree2\",\n\t\t);\n\n\t\tthis.detachedBlobStorage =\n\t\t\tthis.attachState === AttachState.Attached\n\t\t\t\t? undefined\n\t\t\t\t: createMemoryDetachedBlobStorage();\n\n\t\tthis.storageAdapter = new ContainerStorageAdapter(\n\t\t\tthis.detachedBlobStorage,\n\t\t\tthis.mc.logger,\n\t\t\tpendingLocalState?.loadedGroupIdSnapshots,\n\t\t\taddProtocolSummaryIfMissing,\n\t\t\tenableSummarizeProtocolTree,\n\t\t);\n\n\t\tconst offlineLoadEnabled =\n\t\t\tthis.isInteractiveClient &&\n\t\t\t(this.mc.config.getBoolean(\"Fluid.Container.enableOfflineLoad\") ??\n\t\t\t\tthis.mc.config.getBoolean(\"Fluid.Container.enableOfflineFull\") ??\n\t\t\t\toptions.enableOfflineLoad !== false);\n\t\tthis.serializedStateManager = new SerializedStateManager(\n\t\t\tthis.subLogger,\n\t\t\tthis.storageAdapter,\n\t\t\tofflineLoadEnabled,\n\t\t\tthis,\n\t\t\t() => this._deltaManager.connectionManager.shouldJoinWrite(),\n\t\t\t() => this.supportGetSnapshotApi(),\n\t\t\tthis.mc.config.getNumber(\"Fluid.Container.snapshotRefreshTimeoutMs\"),\n\t\t);\n\n\t\tconst isDomAvailable =\n\t\t\ttypeof document === \"object\" &&\n\t\t\tdocument !== null &&\n\t\t\ttypeof document.addEventListener === \"function\" &&\n\t\t\tdocument.addEventListener !== null;\n\t\t// keep track of last time page was visible for telemetry (on interactive clients only)\n\t\tif (isDomAvailable && interactive) {\n\t\t\tthis.lastVisible = document.hidden ? performanceNow() : undefined;\n\t\t\tthis.visibilityEventHandler = (): void => {\n\t\t\t\tif (document.hidden) {\n\t\t\t\t\tthis.lastVisible = performanceNow();\n\t\t\t\t} else {\n\t\t\t\t\t// settimeout so this will hopefully fire after disconnect event if being hidden caused it\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tthis.lastVisible = undefined;\n\t\t\t\t\t}, 0);\n\t\t\t\t}\n\t\t\t};\n\t\t\tdocument.addEventListener(\"visibilitychange\", this.visibilityEventHandler);\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the quorum associated with the document\n\t */\n\tpublic getQuorum(): IQuorumClients {\n\t\treturn this.protocolHandler.quorum;\n\t}\n\n\tpublic dispose(error?: ICriticalContainerError): void {\n\t\tthis.verifyClosedAfter(() => this._deltaManager.dispose(error));\n\t}\n\n\tpublic close(error?: ICriticalContainerError): void {\n\t\t// 1. Ensure that close sequence is exactly the same no matter if it's initiated by host or by DeltaManager\n\t\t// 2. We need to ensure that we deliver disconnect event to runtime properly. See connectionStateChanged\n\t\t// handler. We only deliver events if container fully loaded. Transitioning from \"loading\" ->\n\t\t// \"closing\" will lose that info (can also solve by tracking extra state).\n\t\tthis.verifyClosedAfter(() => this._deltaManager.close(error));\n\t}\n\n\tprivate verifyClosedAfterCalls = 0;\n\tprivate verifyClosedAfter(callback: () => void): void {\n\t\tthis.verifyClosedAfterCalls++;\n\t\ttry {\n\t\t\tcallback();\n\t\t} finally {\n\t\t\tthis.verifyClosedAfterCalls--;\n\t\t}\n\n\t\t// We only want to verify connectionState and lifecycleState after close/dispose has fully finished\n\t\tif (this.verifyClosedAfterCalls === 0) {\n\t\t\tassert(\n\t\t\t\tthis.connectionState === ConnectionState.Disconnected,\n\t\t\t\t0x0cf /* \"disconnect event was not raised!\" */,\n\t\t\t);\n\n\t\t\tassert(\n\t\t\t\tthis._lifecycleState === \"closed\" || this._lifecycleState === \"disposed\",\n\t\t\t\t0x314 /* Container properly closed */,\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate closeCore(error?: ICriticalContainerError): void {\n\t\tassert(!this.closed, 0x315 /* re-entrancy */);\n\n\t\ttry {\n\t\t\t// Ensure that we raise all key events even if one of these throws\n\t\t\ttry {\n\t\t\t\t// Raise event first, to ensure we capture _lifecycleState before transition.\n\t\t\t\t// This gives us a chance to know what errors happened on open vs. on fully loaded container.\n\t\t\t\t// Log generic events instead of error events if container is in loading state, as most errors are not really FF errors\n\t\t\t\t// which can pollute telemetry for real bugs\n\t\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"ContainerClose\",\n\t\t\t\t\t\tcategory:\n\t\t\t\t\t\t\tthis._lifecycleState !== \"loading\" && error !== undefined ? \"error\" : \"generic\",\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\tthis._lifecycleState = \"closing\";\n\n\t\t\t\t// Back-compat for Old driver\n\t\t\t\tif (this.service?.off !== undefined) {\n\t\t\t\t\tthis.service?.off(\"metadataUpdate\", this.metadataUpdateHandler);\n\t\t\t\t}\n\n\t\t\t\tthis._protocolHandler?.close();\n\n\t\t\t\tthis.connectionStateHandler.dispose();\n\t\t\t\tthis.serializedStateManager.dispose();\n\t\t\t} catch (newError) {\n\t\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"ContainerCloseException\" }, newError);\n\t\t\t}\n\n\t\t\tthis.emit(\"closed\", error);\n\n\t\t\tif (this.visibilityEventHandler !== undefined) {\n\t\t\t\tdocument.removeEventListener(\"visibilitychange\", this.visibilityEventHandler);\n\t\t\t}\n\t\t} finally {\n\t\t\tthis._lifecycleState = \"closed\";\n\n\t\t\t// There is no user for summarizer, so we need to ensure dispose is called\n\t\t\tif (this.client.details.type === summarizerClientType) {\n\t\t\t\tthis.dispose(error);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _disposed = false;\n\tprivate disposeCore(error?: ICriticalContainerError): void {\n\t\tassert(!this._disposed, 0x54c /* Container already disposed */);\n\t\tthis._disposed = true;\n\n\t\ttry {\n\t\t\t// Ensure that we raise all key events even if one of these throws\n\t\t\ttry {\n\t\t\t\t// Raise event first, to ensure we capture _lifecycleState before transition.\n\t\t\t\t// This gives us a chance to know what errors happened on open vs. on fully loaded container.\n\t\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"ContainerDispose\",\n\t\t\t\t\t\t// Only log error if container isn't closed\n\t\t\t\t\t\tcategory: !this.closed && error !== undefined ? \"error\" : \"generic\",\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\t// ! Progressing from \"closed\" to \"disposing\" is not allowed\n\t\t\t\tif (this._lifecycleState !== \"closed\") {\n\t\t\t\t\tthis._lifecycleState = \"disposing\";\n\t\t\t\t}\n\n\t\t\t\tthis._protocolHandler?.close();\n\n\t\t\t\tthis.connectionStateHandler.dispose();\n\t\t\t\tthis.serializedStateManager.dispose();\n\n\t\t\t\tconst maybeError = error === undefined ? undefined : new Error(error.message);\n\t\t\t\tthis._runtime?.dispose(maybeError);\n\n\t\t\t\tthis.storageAdapter.dispose();\n\n\t\t\t\t// Notify storage about critical errors. They may be due to disconnect between client & server knowledge\n\t\t\t\t// about file, like file being overwritten in storage, but client having stale local cache.\n\t\t\t\t// Driver need to ensure all caches are cleared on critical errors\n\t\t\t\tthis.service?.dispose(error);\n\t\t\t} catch (error_) {\n\t\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"ContainerDisposeException\" }, error_);\n\t\t\t}\n\n\t\t\tthis.emit(\"disposed\", error);\n\n\t\t\tthis.removeAllListeners();\n\t\t\tif (this.visibilityEventHandler !== undefined) {\n\t\t\t\tdocument.removeEventListener(\"visibilitychange\", this.visibilityEventHandler);\n\t\t\t}\n\t\t} finally {\n\t\t\tthis._lifecycleState = \"disposed\";\n\t\t\tthis._lifecycleEvents.emit(\"disposed\");\n\t\t}\n\t}\n\n\t/**\n\t * Serialize current container state required to rehydrate to the same position without dataloss.\n\t * Note: The container must already be attached. For detached containers use {@link serialize}\n\t * @returns stringified {@link IPendingContainerState} for the container\n\t */\n\tpublic async getPendingLocalState(): Promise<string> {\n\t\tif (this.closed || this._disposed) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Pending state cannot be retried if the container is closed or disposed\",\n\t\t\t);\n\t\t}\n\t\tassert(\n\t\t\tthis.attachmentData.state === AttachState.Attached,\n\t\t\t0x0d1 /* \"Container should be attached before close\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.resolvedUrl !== undefined && this.resolvedUrl.type === \"fluid\",\n\t\t\t0x0d2 /* \"resolved url should be valid Fluid url\" */,\n\t\t);\n\t\tconst pendingState = await this.serializedStateManager.getPendingLocalState(\n\t\t\tthis.clientId,\n\t\t\tthis.runtime,\n\t\t\tthis.resolvedUrl,\n\t\t);\n\t\treturn pendingState;\n\t}\n\n\tpublic get attachState(): AttachState {\n\t\treturn this.attachmentData.state;\n\t}\n\n\t/**\n\t * Serialize current container state required to rehydrate to the same position without dataloss.\n\t * Note: The container must be detached and not closed. For attached containers use\n\t * {@link getPendingLocalState}\n\t * @returns stringified {@link IPendingDetachedContainerState} for the container\n\t */\n\tpublic serialize(): string {\n\t\tif (this.attachmentData.state === AttachState.Attached || this.closed) {\n\t\t\tthrow new UsageError(\"Container must not be attached or closed.\");\n\t\t}\n\n\t\tconst attachingData =\n\t\t\tthis.attachmentData.state === AttachState.Attaching ? this.attachmentData : undefined;\n\n\t\tconst combinedSummary =\n\t\t\tattachingData?.summary ??\n\t\t\tcombineAppAndProtocolSummary(\n\t\t\t\tthis.runtime.createSummary(),\n\t\t\t\tthis.captureProtocolSummary(),\n\t\t\t);\n\n\t\tconst snapshot = getISnapshotFromSerializedContainer(combinedSummary);\n\t\tconst pendingRuntimeState =\n\t\t\tattachingData === undefined ? undefined : this.runtime.getPendingLocalState();\n\t\tassert(!isPromiseLike(pendingRuntimeState), 0x8e3 /* should not be a promise */);\n\n\t\tconst detachedContainerState: IPendingDetachedContainerState = {\n\t\t\tattached: false,\n\t\t\t...convertISnapshotToSnapshotWithBlobs(snapshot),\n\t\t\tpendingRuntimeState,\n\t\t\thasAttachmentBlobs:\n\t\t\t\tthis.detachedBlobStorage !== undefined && this.detachedBlobStorage.size > 0,\n\t\t\tattachmentBlobs: this.detachedBlobStorage?.serialize(),\n\t\t};\n\t\treturn JSON.stringify(detachedContainerState);\n\t}\n\n\tpublic readonly attach = runSingle(\n\t\tasync (\n\t\t\trequest: IRequest,\n\t\t\tattachProps?: { deltaConnection?: \"none\" | \"delayed\" },\n\t\t): Promise<void> => {\n\t\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.mc.logger,\n\t\t\t\t{ eventName: \"Attach\" },\n\t\t\t\tasync () => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis._lifecycleState !== \"loaded\" ||\n\t\t\t\t\t\tthis.attachmentData.state === AttachState.Attached\n\t\t\t\t\t) {\n\t\t\t\t\t\t// pre-0.58 error message: containerNotValidForAttach\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`The Container is not in a valid state for attach [${this._lifecycleState}] and [${this.attachState}]`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst normalizeErrorAndClose = (error: unknown): IFluidErrorBase => {\n\t\t\t\t\t\tconst newError = normalizeError(error);\n\t\t\t\t\t\tthis.close(newError);\n\t\t\t\t\t\t// add resolved URL on error object so that host has the ability to find this document and delete it\n\t\t\t\t\t\tnewError.addTelemetryProperties({\n\t\t\t\t\t\t\tresolvedUrl: this.service?.resolvedUrl?.url,\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn newError;\n\t\t\t\t\t};\n\n\t\t\t\t\tconst setAttachmentData: AttachProcessProps[\"setAttachmentData\"] = (\n\t\t\t\t\t\tattachmentData,\n\t\t\t\t\t) => {\n\t\t\t\t\t\tconst previousState = this.attachmentData.state;\n\t\t\t\t\t\tthis.attachmentData = attachmentData;\n\t\t\t\t\t\tconst state = this.attachmentData.state;\n\t\t\t\t\t\tif (state !== previousState && state !== AttachState.Detached) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tthis.runtime.setAttachState(state);\n\t\t\t\t\t\t\t\tthis.emit(state.toLocaleLowerCase());\n\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\tthrow normalizeErrorAndClose(error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tconst createAttachmentSummary: AttachProcessProps[\"createAttachmentSummary\"] = (\n\t\t\t\t\t\tredirectTable?: Map<string, string>,\n\t\t\t\t\t) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tthis._deltaManager.inbound.length === 0,\n\t\t\t\t\t\t\t\t0x0d6 /* \"Inbound queue should be empty when attaching\" */,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn combineAppAndProtocolSummary(\n\t\t\t\t\t\t\t\tthis.runtime.createSummary(redirectTable),\n\t\t\t\t\t\t\t\tthis.captureProtocolSummary(),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tthrow normalizeErrorAndClose(error);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tconst createOrGetStorageService: AttachProcessProps[\"createOrGetStorageService\"] =\n\t\t\t\t\t\tasync (summary) => {\n\t\t\t\t\t\t\t// Actually go and create the resolved document\n\t\t\t\t\t\t\tif (this.service === undefined) {\n\t\t\t\t\t\t\t\tconst createNewResolvedUrl = await this.urlResolver.resolve(request);\n\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\tthis.client.details.type !== summarizerClientType &&\n\t\t\t\t\t\t\t\t\t\tcreateNewResolvedUrl !== undefined,\n\t\t\t\t\t\t\t\t\t0x2c4 /* \"client should not be summarizer before container is created\" */,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tthis.service = await this.createDocumentService(createNewResolvedUrl, {\n\t\t\t\t\t\t\t\t\tmode: \"attach\",\n\t\t\t\t\t\t\t\t\tsummary,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis.storageAdapter.connectToService(this.service);\n\t\t\t\t\t\t\treturn this.storageAdapter;\n\t\t\t\t\t\t};\n\n\t\t\t\t\tlet attachP = runRetriableAttachProcess({\n\t\t\t\t\t\tinitialAttachmentData: this.attachmentData,\n\t\t\t\t\t\tdetachedBlobStorage: this.detachedBlobStorage,\n\t\t\t\t\t\tsetAttachmentData,\n\t\t\t\t\t\tcreateAttachmentSummary,\n\t\t\t\t\t\tcreateOrGetStorageService,\n\t\t\t\t\t});\n\n\t\t\t\t\t// only enable the new behavior if the config is set\n\t\t\t\t\tif (this.mc.config.getBoolean(\"Fluid.Container.RetryOnAttachFailure\") !== true) {\n\t\t\t\t\t\tattachP = attachP.catch((error) => {\n\t\t\t\t\t\t\tthrow normalizeErrorAndClose(error);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// If offline load is enabled, attachP will return the attach summary (in Snapshot format) so we can initialize SerializedStateManager\n\t\t\t\t\tconst snapshotWithBlobs = await attachP;\n\t\t\t\t\tthis.serializedStateManager.setInitialSnapshot(snapshotWithBlobs);\n\t\t\t\t\tif (!this.closed) {\n\t\t\t\t\t\tthis.detachedBlobStorage?.dispose?.();\n\t\t\t\t\t\tthis.handleDeltaConnectionArg(attachProps?.deltaConnection, {\n\t\t\t\t\t\t\tfetchOpsFromStorage: false,\n\t\t\t\t\t\t\treason: { text: \"createDetached\" },\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{ start: true, end: true, cancel: \"generic\" },\n\t\t\t);\n\t\t},\n\t);\n\n\tprivate setAutoReconnectInternal(\n\t\tmode: ReconnectMode,\n\t\treason: IConnectionStateChangeReason,\n\t): void {\n\t\tconst currentMode = this._deltaManager.connectionManager.reconnectMode;\n\n\t\tif (currentMode === mode) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst now = performanceNow();\n\t\tconst duration = now - this.setAutoReconnectTime;\n\t\tthis.setAutoReconnectTime = now;\n\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName:\n\t\t\t\tmode === ReconnectMode.Enabled ? \"AutoReconnectEnabled\" : \"AutoReconnectDisabled\",\n\t\t\tconnectionMode: this.connectionMode,\n\t\t\tconnectionState: ConnectionState[this.connectionState],\n\t\t\tduration,\n\t\t});\n\n\t\tthis._deltaManager.connectionManager.setAutoReconnect(mode, reason);\n\t}\n\n\tpublic connect(): void {\n\t\tif (this.closed) {\n\t\t\tthrow new UsageError(`The Container is closed and cannot be connected`);\n\t\t} else if (this.attachState !== AttachState.Attached) {\n\t\t\tthrow new UsageError(`The Container is not attached and cannot be connected`);\n\t\t} else if (!this.connected) {\n\t\t\t// Note: no need to fetch ops as we do it preemptively as part of DeltaManager.attachOpHandler().\n\t\t\t// If there is gap, we will learn about it once connected, but the gap should be small (if any),\n\t\t\t// assuming that connect() is called quickly after initial container boot.\n\t\t\tthis.connectInternal({\n\t\t\t\treason: { text: \"DocumentConnect\" },\n\t\t\t\tfetchOpsFromStorage: false,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate connectInternal(args: IConnectionArgs): void {\n\t\tassert(!this.closed, 0x2c5 /* \"Attempting to connect() a closed Container\" */);\n\t\tassert(\n\t\t\tthis.attachState === AttachState.Attached,\n\t\t\t0x2c6 /* \"Attempting to connect() a container that is not attached\" */,\n\t\t);\n\n\t\t// Set Auto Reconnect Mode\n\t\tconst mode = ReconnectMode.Enabled;\n\t\tthis.setAutoReconnectInternal(mode, args.reason);\n\n\t\t// Resume processing ops and connect to delta stream\n\t\tthis.resumeInternal(args);\n\t}\n\n\tpublic disconnect(): void {\n\t\tif (this.closed) {\n\t\t\tthrow new UsageError(`The Container is closed and cannot be disconnected`);\n\t\t} else {\n\t\t\tthis.disconnectInternal({ text: \"DocumentDisconnect\" });\n\t\t}\n\t}\n\n\tprivate disconnectInternal(reason: IConnectionStateChangeReason): void {\n\t\tassert(!this.closed, 0x2c7 /* \"Attempting to disconnect() a closed Container\" */);\n\n\t\t// Set Auto Reconnect Mode\n\t\tconst mode = ReconnectMode.Disabled;\n\t\tthis.setAutoReconnectInternal(mode, reason);\n\t}\n\n\tprivate resumeInternal(args: IConnectionArgs): void {\n\t\tassert(!this.closed, 0x0d9 /* \"Attempting to connect() a closed DeltaManager\" */);\n\n\t\t// Resume processing ops\n\t\tif (this.inboundQueuePausedFromInit) {\n\t\t\t// This assert guards against possibility of ops/signals showing up too soon, while\n\t\t\t// container is not ready yet to receive them. We can hit it only if some internal code call into here,\n\t\t\t// as public API like Container.connect() can be only called when user got back container object, i.e.\n\t\t\t// it is already fully loaded.\n\t\t\tassert(this.loaded, 0x96c /* connect() can be called only in fully loaded state */);\n\n\t\t\tthis.inboundQueuePausedFromInit = false;\n\t\t\tthis._deltaManager.inbound.resume();\n\t\t\tthis._deltaManager.inboundSignal.resume();\n\t\t}\n\n\t\t// Ensure connection to web socket\n\t\tthis.connectToDeltaStream(args);\n\t}\n\n\tpublic readonly getAbsoluteUrl = async (\n\t\trelativeUrl: string,\n\t): Promise<string | undefined> => {\n\t\tif (this.resolvedUrl === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn this.urlResolver.getAbsoluteUrl(\n\t\t\tthis.resolvedUrl,\n\t\t\trelativeUrl,\n\t\t\tgetPackageName(this._loadedCodeDetails),\n\t\t);\n\t};\n\n\tpublic async proposeCodeDetails(codeDetails: IFluidCodeDetails): Promise<boolean> {\n\t\tif (!isFluidCodeDetails(codeDetails)) {\n\t\t\tthrow new Error(\"Provided codeDetails are not IFluidCodeDetails\");\n\t\t}\n\n\t\tif (this.codeLoader.IFluidCodeDetailsComparer) {\n\t\t\tconst comparison = await this.codeLoader.IFluidCodeDetailsComparer.compare(\n\t\t\t\tcodeDetails,\n\t\t\t\tthis.getCodeDetailsFromQuorum(),\n\t\t\t);\n\t\t\tif (comparison !== undefined && comparison <= 0) {\n\t\t\t\tthrow new Error(\"Proposed code details should be greater than the current\");\n\t\t\t}\n\t\t}\n\n\t\treturn this.protocolHandler.quorum\n\t\t\t.propose(\"code\", codeDetails)\n\t\t\t.then(() => true)\n\t\t\t.catch(() => false);\n\t}\n\n\tprivate async processCodeProposal(): Promise<void> {\n\t\tconst codeDetails = this.getCodeDetailsFromQuorum();\n\n\t\tawait Promise.all([\n\t\t\tthis._deltaManager.inbound.pause(),\n\t\t\tthis._deltaManager.inboundSignal.pause(),\n\t\t]);\n\n\t\tif ((await this.satisfies(codeDetails)) === true) {\n\t\t\tthis._deltaManager.inbound.resume();\n\t\t\tthis._deltaManager.inboundSignal.resume();\n\t\t\treturn;\n\t\t}\n\n\t\t// pre-0.58 error message: existingContextDoesNotSatisfyIncomingProposal\n\t\tconst error = new GenericError(\"Existing context does not satisfy incoming proposal\");\n\t\tthis.close(error);\n\t}\n\n\t/**\n\t * Determines if the currently loaded module satisfies the incoming constraint code details\n\t */\n\tprivate async satisfies(constraintCodeDetails: IFluidCodeDetails): Promise<boolean> {\n\t\t// If we have no module, it can't satisfy anything.\n\t\tif (this._loadedModule === undefined) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst comparers: IFluidCodeDetailsComparer[] = [];\n\n\t\tconst maybeCompareCodeLoader = this.codeLoader;\n\t\tif (maybeCompareCodeLoader.IFluidCodeDetailsComparer !== undefined) {\n\t\t\tcomparers.push(maybeCompareCodeLoader.IFluidCodeDetailsComparer);\n\t\t}\n\n\t\tconst maybeCompareExport: Partial<IProvideFluidCodeDetailsComparer> | undefined =\n\t\t\tthis._loadedModule?.module.fluidExport;\n\t\tif (maybeCompareExport?.IFluidCodeDetailsComparer !== undefined) {\n\t\t\tcomparers.push(maybeCompareExport.IFluidCodeDetailsComparer);\n\t\t}\n\n\t\t// If there are no comparers, then it's impossible to know if the currently loaded package satisfies\n\t\t// the incoming constraint, so we return false. Assuming it does not satisfy is safer, to force a reload\n\t\t// rather than potentially running with incompatible code.\n\t\tif (comparers.length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (const comparer of comparers) {\n\t\t\tconst satisfies = await comparer.satisfies(\n\t\t\t\tthis._loadedModule?.details,\n\t\t\t\tconstraintCodeDetails,\n\t\t\t);\n\t\t\tif (satisfies === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate connectToDeltaStream(args: IConnectionArgs): void {\n\t\t// All agents need \"write\" access, including summarizer.\n\t\tif (!this._canReconnect || !this.client.details.capabilities.interactive) {\n\t\t\targs.mode = \"write\";\n\t\t}\n\n\t\tthis._deltaManager.connect(args);\n\t}\n\n\tprivate readonly metadataUpdateHandler = (metadata: Record<string, string>): void => {\n\t\tthis._containerMetadata = { ...this._containerMetadata, ...metadata };\n\t\tthis.emit(\"metadataUpdate\", metadata);\n\t};\n\n\t/**\n\t * Creates a document service during container attachment or loading.\n\t * @param resolvedUrl - The resolved URL of the container.\n\t * @param props - Properties indicating whether to load or attach the container. For attaching,\n\t * a summary tree can be provided.\n\t * @remarks This method validates that the driver is compatible with the Loader.\n\t */\n\tprivate async createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tprops: { mode: \"load\" } | { mode: \"attach\"; summary: ISummaryTree | undefined },\n\t): Promise<IDocumentService> {\n\t\tlet service: IDocumentService;\n\t\tif (props.mode === \"load\") {\n\t\t\tservice = await this.serviceFactory.createDocumentService(\n\t\t\t\tresolvedUrl,\n\t\t\t\tthis.subLogger,\n\t\t\t\tthis.client.details.type === summarizerClientType,\n\t\t\t);\n\t\t\tif (service.on !== undefined) {\n\t\t\t\t// Back-compat for Old driver\n\t\t\t\tservice.on(\"metadataUpdate\", this.metadataUpdateHandler);\n\t\t\t}\n\t\t} else {\n\t\t\tservice = await runWithRetry(\n\t\t\t\tasync () =>\n\t\t\t\t\tthis.serviceFactory.createContainer(\n\t\t\t\t\t\tprops.summary,\n\t\t\t\t\t\tresolvedUrl,\n\t\t\t\t\t\tthis.subLogger,\n\t\t\t\t\t\tfalse, // clientIsSummarizer\n\t\t\t\t\t),\n\t\t\t\t\"containerAttach\",\n\t\t\t\tthis.mc.logger,\n\t\t\t\t{\n\t\t\t\t\tcancel: this._deltaManager.closeAbortController.signal,\n\t\t\t\t}, // progress\n\t\t\t);\n\t\t}\n\t\treturn service;\n\t}\n\n\t/**\n\t * Load container.\n\t *\n\t * @param specifiedVersion - Version SHA to load snapshot. If not specified, will fetch the latest snapshot.\n\t */\n\tprivate async load(\n\t\tspecifiedVersion: string | undefined,\n\t\tloadMode: IContainerLoadMode,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tpendingLocalState: IPendingContainerState | undefined,\n\t): Promise<{\n\t\tsequenceNumber: number;\n\t\tversion: string | undefined;\n\t\tdmLastProcessedSeqNumber: number;\n\t\tdmLastKnownSeqNumber: number;\n\t}> {\n\t\tconst timings: Record<string, number> = { phase1: performanceNow() };\n\t\tthis.service = await this.createDocumentService(resolvedUrl, { mode: \"load\" });\n\n\t\t// Except in cases where its requested by feature gate, the container will connect in \"read\" mode\n\t\tconst mode =\n\t\t\tthis.mc.config.getBoolean(\"Fluid.Container.ForceWriteConnection\") === true\n\t\t\t\t? \"write\"\n\t\t\t\t: \"read\";\n\t\tconst connectionArgs: IConnectionArgs = {\n\t\t\treason: { text: \"DocumentOpen\" },\n\t\t\tmode,\n\t\t\tfetchOpsFromStorage: false,\n\t\t};\n\n\t\t// Start websocket connection as soon as possible. Note that there is no op handler attached yet, but the\n\t\t// DeltaManager is resilient to this and will wait to start processing ops until after it is attached.\n\t\tif (loadMode.deltaConnection === undefined) {\n\t\t\tthis.connectToDeltaStream(connectionArgs);\n\t\t}\n\n\t\tthis.storageAdapter.connectToService(this.service);\n\n\t\tthis.attachmentData = {\n\t\t\tstate: AttachState.Attached,\n\t\t};\n\n\t\ttimings.phase2 = performanceNow();\n\n\t\t// Fetch specified snapshot.\n\t\tconst {\n\t\t\tsnapshot: baseSnapshot,\n\t\t\tversion,\n\t\t\tattributes,\n\t\t} = await this.serializedStateManager.fetchSnapshot(specifiedVersion, pendingLocalState);\n\t\tconst baseSnapshotTree: ISnapshotTree | undefined = getSnapshotTree(baseSnapshot);\n\t\tthis._loadedFromVersion = version;\n\n\t\t// If we saved ops, we will replay them and don't need DeltaManager to fetch them\n\t\tconst lastProcessedSequenceNumber =\n\t\t\tpendingLocalState?.savedOps[pendingLocalState.savedOps.length - 1]?.sequenceNumber ??\n\t\t\tattributes.sequenceNumber;\n\t\tlet opsBeforeReturnP: Promise<void> | undefined;\n\n\t\t// Attach op handlers to finish initialization and be able to start processing ops\n\t\t// Kick off any ops fetching if required.\n\t\tswitch (loadMode.opsBeforeReturn) {\n\t\t\tcase undefined: {\n\t\t\t\t// Start prefetch, but not set opsBeforeReturnP - boot is not blocked by it!\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\t\tthis.attachDeltaManagerOpHandler(\n\t\t\t\t\tattributes,\n\t\t\t\t\tloadMode.deltaConnection === \"none\" ? \"none\" : \"all\",\n\t\t\t\t\tlastProcessedSequenceNumber,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"cached\":\n\t\t\tcase \"all\": {\n\t\t\t\topsBeforeReturnP = this.attachDeltaManagerOpHandler(\n\t\t\t\t\tattributes,\n\t\t\t\t\tloadMode.opsBeforeReturn,\n\t\t\t\t\tlastProcessedSequenceNumber,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(loadMode.opsBeforeReturn);\n\t\t\t}\n\t\t}\n\n\t\t// ...load in the existing quorum\n\t\t// Initialize the protocol handler\n\t\tawait this.initializeProtocolStateFromSnapshot(\n\t\t\tattributes,\n\t\t\tthis.storageAdapter,\n\t\t\tbaseSnapshotTree,\n\t\t);\n\n\t\t// If we are loading from pending state, we start with old clientId.\n\t\t// We switch to latest connection clientId only after setLoaded().\n\t\tassert(this.clientId === undefined, 0x96d /* there should be no clientId yet */);\n\t\tif (pendingLocalState?.clientId !== undefined) {\n\t\t\tthis.protocolHandler.audience.setCurrentClientId(pendingLocalState?.clientId);\n\t\t}\n\n\t\ttimings.phase3 = performanceNow();\n\t\tconst codeDetails = this.getCodeDetailsFromQuorum();\n\t\tawait this.instantiateRuntime(\n\t\t\tcodeDetails,\n\t\t\tbaseSnapshotTree,\n\t\t\t// give runtime a dummy value so it knows we're loading from a stash blob\n\t\t\tpendingLocalState ? (pendingLocalState?.pendingRuntimeState ?? {}) : undefined,\n\t\t\tisInstanceOfISnapshot(baseSnapshot) ? baseSnapshot : undefined,\n\t\t);\n\n\t\t// replay saved ops\n\t\tif (pendingLocalState) {\n\t\t\tfor (const message of pendingLocalState.savedOps) {\n\t\t\t\tthis.processRemoteMessage({\n\t\t\t\t\t...message,\n\t\t\t\t\tmetadata: { ...(message.metadata as Record<string, unknown>), savedOp: true },\n\t\t\t\t});\n\n\t\t\t\t// allow runtime to apply stashed ops at this op's sequence number\n\t\t\t\tawait this.runtime.notifyOpReplay?.(message);\n\t\t\t}\n\t\t\tpendingLocalState.savedOps = [];\n\t\t\tthis.storageAdapter.clearPendingState();\n\t\t}\n\n\t\t// We might have hit some failure that did not manifest itself in exception in this flow,\n\t\t// do not start op processing in such case - static version of Container.load() will handle it correctly.\n\t\tif (!this.closed) {\n\t\t\tif (opsBeforeReturnP !== undefined) {\n\t\t\t\tthis._deltaManager.inbound.resume();\n\n\t\t\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\t\t\tthis.mc.logger,\n\t\t\t\t\t{ eventName: \"WaitOps\" },\n\t\t\t\t\tasync () => opsBeforeReturnP,\n\t\t\t\t);\n\t\t\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\t\t\tthis.mc.logger,\n\t\t\t\t\t{ eventName: \"WaitOpProcessing\" },\n\t\t\t\t\tasync () => this._deltaManager.inbound.waitTillProcessingDone(),\n\t\t\t\t);\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\t\tthis._deltaManager.inbound.pause();\n\t\t\t}\n\n\t\t\t// Internal context is fully loaded at this point\n\t\t\t// Move to loaded before calling this.handleDeltaConnectionArg() - latter allows ops & signals in, which\n\t\t\t// may result in container moving to \"connected\" state. Such transitions are allowed only in loaded state.\n\t\t\tthis.setLoaded();\n\n\t\t\tthis.handleDeltaConnectionArg(loadMode.deltaConnection);\n\t\t}\n\n\t\t// Safety net: static version of Container.load() should have learned about it through \"closed\" handler.\n\t\t// But if that did not happen for some reason, fail load for sure.\n\t\t// Otherwise we can get into situations where container is closed and does not try to connect to ordering\n\t\t// service, but caller does not know that (callers do expect container to be not closed on successful path\n\t\t// and listen only on \"closed\" event)\n\t\tif (this.closed) {\n\t\t\tthrow new Error(\"Container was closed while load()\");\n\t\t}\n\n\t\ttimings.end = performanceNow();\n\t\tthis.subLogger.sendTelemetryEvent(\n\t\t\t{\n\t\t\t\teventName: \"LoadStagesTimings\",\n\t\t\t\tdetails: JSON.stringify(timings),\n\t\t\t},\n\t\t\tundefined,\n\t\t\tLogLevel.verbose,\n\t\t);\n\t\treturn {\n\t\t\tsequenceNumber: attributes.sequenceNumber,\n\t\t\tversion: version?.id,\n\t\t\tdmLastProcessedSeqNumber: this._deltaManager.lastSequenceNumber,\n\t\t\tdmLastKnownSeqNumber: this._deltaManager.lastKnownSeqNumber,\n\t\t};\n\t}\n\n\tprivate async createDetached(codeDetails: IFluidCodeDetails): Promise<void> {\n\t\tconst attributes: IDocumentAttributes = {\n\t\t\tsequenceNumber: detachedContainerRefSeqNumber,\n\t\t\tminimumSequenceNumber: 0,\n\t\t};\n\n\t\tawait this.attachDeltaManagerOpHandler(attributes);\n\n\t\t// Need to just seed the source data in the code quorum. Quorum itself is empty\n\t\tconst qValues = initQuorumValuesFromCodeDetails(codeDetails);\n\t\tthis.initializeProtocolState(\n\t\t\tattributes,\n\t\t\t{\n\t\t\t\tmembers: [],\n\t\t\t\tproposals: [],\n\t\t\t\tvalues: qValues,\n\t\t\t}, // IQuorumSnapShot\n\t\t);\n\n\t\tawait this.instantiateRuntime(codeDetails, undefined);\n\n\t\tthis.setLoaded();\n\t}\n\n\tprivate async rehydrateDetachedFromSnapshot({\n\t\tbaseSnapshot,\n\t\tsnapshotBlobs,\n\t\thasAttachmentBlobs,\n\t\tattachmentBlobs,\n\t\tpendingRuntimeState,\n\t}: IPendingDetachedContainerState): Promise<void> {\n\t\tif (hasAttachmentBlobs) {\n\t\t\tif (attachmentBlobs !== undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tthis.detachedBlobStorage !== undefined,\n\t\t\t\t\t0xb8e /* detached blob storage should always exist when detached */,\n\t\t\t\t);\n\t\t\t\ttryInitializeMemoryDetachedBlobStorage(this.detachedBlobStorage, attachmentBlobs);\n\t\t\t}\n\t\t\tassert(\n\t\t\t\tthis.detachedBlobStorage !== undefined && this.detachedBlobStorage.size > 0,\n\t\t\t\t0x250 /* \"serialized container with attachment blobs must be rehydrated with detached blob storage\" */,\n\t\t\t);\n\t\t}\n\n\t\tconst snapshot = convertSnapshotInfoToSnapshot({\n\t\t\tbaseSnapshot,\n\t\t\tsnapshotBlobs,\n\t\t\tsnapshotSequenceNumber: 0,\n\t\t});\n\n\t\tthis.storageAdapter.cacheSnapshotBlobs(snapshot.blobContents);\n\t\tconst attributes = await getDocumentAttributes(this.storageAdapter, snapshot.snapshotTree);\n\n\t\tawait this.attachDeltaManagerOpHandler(attributes);\n\n\t\t// Initialize the protocol handler\n\t\tconst baseTree = getProtocolSnapshotTree(snapshot.snapshotTree);\n\t\tconst qValues = await readAndParse<[string, ICommittedProposal][]>(\n\t\t\tthis.storageAdapter,\n\t\t\tbaseTree.blobs.quorumValues,\n\t\t);\n\t\tthis.initializeProtocolState(\n\t\t\tattributes,\n\t\t\t{\n\t\t\t\tmembers: [],\n\t\t\t\tproposals: [],\n\t\t\t\tvalues: qValues,\n\t\t\t}, // IQuorumSnapShot\n\t\t);\n\t\tconst codeDetails = this.getCodeDetailsFromQuorum();\n\n\t\tawait this.instantiateRuntime(\n\t\t\tcodeDetails,\n\t\t\tcombineSnapshotTreeAndSnapshotBlobs(snapshot),\n\t\t\tpendingRuntimeState,\n\t\t\tsnapshot,\n\t\t);\n\n\t\tthis.setLoaded();\n\t}\n\n\tprivate async initializeProtocolStateFromSnapshot(\n\t\tattributes: IDocumentAttributes,\n\t\tstorage: IContainerStorageService,\n\t\tsnapshot: ISnapshotTree | undefined,\n\t): Promise<void> {\n\t\tconst quorumSnapshot: IQuorumSnapshot = {\n\t\t\tmembers: [],\n\t\t\tproposals: [],\n\t\t\tvalues: [],\n\t\t};\n\n\t\tif (snapshot !== undefined) {\n\t\t\tconst baseTree = getProtocolSnapshotTree(snapshot);\n\t\t\t[quorumSnapshot.members, quorumSnapshot.proposals, quorumSnapshot.values] =\n\t\t\t\tawait Promise.all([\n\t\t\t\t\treadAndParse<[string, ISequencedClient][]>(storage, baseTree.blobs.quorumMembers),\n\t\t\t\t\treadAndParse<[number, ISequencedProposal, string[]][]>(\n\t\t\t\t\t\tstorage,\n\t\t\t\t\t\tbaseTree.blobs.quorumProposals,\n\t\t\t\t\t),\n\t\t\t\t\treadAndParse<[string, ICommittedProposal][]>(storage, baseTree.blobs.quorumValues),\n\t\t\t\t]);\n\t\t}\n\n\t\tthis.initializeProtocolState(attributes, quorumSnapshot);\n\t}\n\n\tprivate initializeProtocolState(\n\t\tattributes: IDocumentAttributes,\n\t\tquorumSnapshot: IQuorumSnapshot,\n\t): void {\n\t\tconst protocol = this.protocolHandlerBuilder(attributes, quorumSnapshot, (key, value) =>\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\tthis.submitMessage(MessageType.Propose, JSON.stringify({ key, value })),\n\t\t);\n\n\t\tconst protocolLogger = createChildLogger({\n\t\t\tlogger: this.subLogger,\n\t\t\tnamespace: \"ProtocolHandler\",\n\t\t});\n\n\t\tprotocol.quorum.on(\"error\", (error: ITelemetryErrorEventExt) => {\n\t\t\tprotocolLogger.sendErrorEvent(error);\n\t\t});\n\n\t\tprotocol.quorum.on(\"addProposal\", (proposal: ISequencedProposal) => {\n\t\t\tif (proposal.key === \"code\" || proposal.key === \"code2\") {\n\t\t\t\tthis.emit(\"codeDetailsProposed\", proposal.value, proposal);\n\t\t\t}\n\t\t});\n\n\t\tprotocol.quorum.on(\"approveProposal\", (sequenceNumber, key, value) => {\n\t\t\tif (key === \"code\" || key === \"code2\") {\n\t\t\t\tif (!isFluidCodeDetails(value)) {\n\t\t\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\t\t\teventName: \"CodeProposalNotIFluidCodeDetails\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis.processCodeProposal().catch((error) => {\n\t\t\t\t\tconst normalizedError = normalizeError(error);\n\t\t\t\t\tthis.close(normalizedError);\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\t// we need to make sure this member get set in a synchronous context,\n\t\t// or other things can happen after the object that will be set is created, but not yet set\n\t\t// this was breaking this._initialClients handling\n\t\t//\n\t\tthis._protocolHandler = protocol;\n\t}\n\n\tprivate captureProtocolSummary(): ISummaryTree {\n\t\tconst quorumSnapshot = this.protocolHandler.snapshot();\n\t\tconst summary: ISummaryTree = {\n\t\t\ttree: {\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: JSON.stringify(this.protocolHandler.attributes),\n\t\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\t},\n\t\t\t\tquorumMembers: {\n\t\t\t\t\tcontent: JSON.stringify(quorumSnapshot.members),\n\t\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\t},\n\t\t\t\tquorumProposals: {\n\t\t\t\t\tcontent: JSON.stringify(quorumSnapshot.proposals),\n\t\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\t},\n\t\t\t\tquorumValues: {\n\t\t\t\t\tcontent: JSON.stringify(quorumSnapshot.values),\n\t\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\t},\n\t\t\t},\n\t\t\ttype: SummaryType.Tree,\n\t\t};\n\n\t\treturn summary;\n\t}\n\n\tprivate getCodeDetailsFromQuorum(): IFluidCodeDetails {\n\t\tconst quorum = this.protocolHandler.quorum;\n\n\t\tconst pkg = getCodeProposal(quorum);\n\n\t\treturn pkg as IFluidCodeDetails;\n\t}\n\n\tprivate static setupClient(\n\t\tcontainerId: string,\n\t\tloaderOptionsClient?: IClient,\n\t\tclientDetailsOverride?: IClientDetails,\n\t): IClient {\n\t\tconst client: IClient =\n\t\t\tloaderOptionsClient === undefined\n\t\t\t\t? {\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\tcapabilities: { interactive: true },\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmode: \"read\", // default reconnection mode on lost connection / connection error\n\t\t\t\t\t\tpermission: [],\n\t\t\t\t\t\tscopes: [],\n\t\t\t\t\t\tuser: { id: \"\" },\n\t\t\t\t\t}\n\t\t\t\t: structuredClone(loaderOptionsClient);\n\n\t\tif (clientDetailsOverride !== undefined) {\n\t\t\tclient.details = {\n\t\t\t\t...client.details,\n\t\t\t\t...clientDetailsOverride,\n\t\t\t\tcapabilities: {\n\t\t\t\t\t...client.details.capabilities,\n\t\t\t\t\t...clientDetailsOverride?.capabilities,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tclient.details.environment = [\n\t\t\tclient.details.environment,\n\t\t\t` loaderVersion:${pkgVersion}`,\n\t\t\t` containerId:${containerId}`,\n\t\t].join(\";\");\n\n\t\treturn client;\n\t}\n\n\t/**\n\t * Returns true if connection is active, i.e. it's \"write\" connection and\n\t * container runtime was notified about this connection (i.e. we are up-to-date and could send ops).\n\t * This happens after client received its own joinOp and thus is in the quorum.\n\t * If it's not true, runtime is not in position to send ops.\n\t */\n\tprivate activeConnection(): boolean {\n\t\treturn (\n\t\t\tthis.connectionState === ConnectionState.Connected && this.connectionMode === \"write\"\n\t\t);\n\t}\n\n\tprivate createDeltaManager(): DeltaManager<ConnectionManager> {\n\t\tconst serviceProvider = (): IDocumentService | undefined => this.service;\n\t\tconst deltaManager = new DeltaManager<ConnectionManager>(\n\t\t\tserviceProvider,\n\t\t\tcreateChildLogger({ logger: this.subLogger, namespace: \"DeltaManager\" }),\n\t\t\t() => this.activeConnection(),\n\t\t\t(props: IConnectionManagerFactoryArgs) =>\n\t\t\t\tnew ConnectionManager(\n\t\t\t\t\tserviceProvider,\n\t\t\t\t\t() => this.isDirty,\n\t\t\t\t\tthis.client,\n\t\t\t\t\tthis._canReconnect,\n\t\t\t\t\tcreateChildLogger({ logger: this.subLogger, namespace: \"ConnectionManager\" }),\n\t\t\t\t\tprops,\n\t\t\t\t),\n\t\t);\n\n\t\t// Disable inbound queues as Container is not ready to accept any ops until we are fully loaded!\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tdeltaManager.inbound.pause();\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tdeltaManager.inboundSignal.pause();\n\n\t\tdeltaManager.on(\"connect\", (details: IConnectionDetailsInternal, _opsBehind?: number) => {\n\t\t\tassert(this.connectionMode === details.mode, 0x4b7 /* mismatch */);\n\n\t\t\t// Delay raising events until setLoaded()\n\t\t\t// Here are some of the reasons why this design is chosen:\n\t\t\t// 1. Various processes track speed of connection. But we are not processing ops or signal while container is loading,\n\t\t\t// and thus we can't move forward across connection modes. This results in telemetry errors (like NoJoinOp) that\n\t\t\t// have nothing to do with connection flow itself\n\t\t\t// 2. This also makes it hard to reason about recovery (like reconnection) in case we might have lost JoinSignal. Reconnecting\n\t\t\t// in loading phase is useless (get back to same state), but at the same time not doing it may result in broken connection\n\t\t\t// without recovery (after we loaded).\n\t\t\t// 3. We expose non-consistent view. ContainerRuntime may start loading in non-connected state, but end in connected, with\n\t\t\t// no events telling about it (until we loaded). Most of the code relies on a fact that state changes when events fire.\n\t\t\t// This will not delay any processes (as observed by the user). I.e. once container moves to loaded phase,\n\t\t\t// we immediately would transition across all phases, if we have proper signals / ops ready.\n\t\t\tif (this.loaded) {\n\t\t\t\tthis.connectionStateHandler.receivedConnectEvent(details);\n\t\t\t}\n\t\t});\n\n\t\tdeltaManager.on(\"establishingConnection\", (reason: IConnectionStateChangeReason) => {\n\t\t\tthis.connectionStateHandler.establishingConnection(reason);\n\t\t});\n\n\t\tdeltaManager.on(\"cancelEstablishingConnection\", (reason: IConnectionStateChangeReason) => {\n\t\t\tthis.connectionStateHandler.cancelEstablishingConnection(reason);\n\t\t});\n\n\t\tdeltaManager.on(\"disconnect\", (text, error) => {\n\t\t\tthis.noopHeuristic?.notifyDisconnect();\n\t\t\tconst reason = { text, error };\n\t\t\t// Symmetry with \"connect\" events\n\t\t\tif (this.loaded) {\n\t\t\t\tthis.connectionStateHandler.receivedDisconnectEvent(reason);\n\t\t\t} else if (!this.closed) {\n\t\t\t\t// Raise cancellation to get state machine back to initial state\n\t\t\t\tthis.connectionStateHandler.cancelEstablishingConnection(reason);\n\t\t\t}\n\t\t});\n\n\t\tdeltaManager.on(\"throttled\", (warning: IThrottlingWarning) => {\n\t\t\tconst warn = warning as ContainerWarning;\n\t\t\t// Some \"warning\" events come from outside the container and are logged\n\t\t\t// elsewhere (e.g. summarizing container). We shouldn't log these here.\n\t\t\tif (warn.logged !== true) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"ContainerWarning\" }, warn);\n\t\t\t}\n\t\t\tthis.emit(\"warning\", warn);\n\t\t});\n\n\t\tdeltaManager.on(\"readonly\", (readonly) => {\n\t\t\tif (this.loaded) {\n\t\t\t\tthis.setConnectionStatus(readonly);\n\t\t\t}\n\t\t\tthis.emit(\"readonly\", readonly);\n\t\t});\n\n\t\tdeltaManager.on(\"closed\", (error?: ICriticalContainerError) => {\n\t\t\tthis.closeCore(error);\n\t\t});\n\n\t\tdeltaManager.on(\"disposed\", (error?: ICriticalContainerError) => {\n\t\t\tthis.disposeCore(error);\n\t\t});\n\n\t\treturn deltaManager;\n\t}\n\n\tprivate async attachDeltaManagerOpHandler(\n\t\tattributes: IDocumentAttributes,\n\t\tprefetchType?: \"cached\" | \"all\" | \"none\",\n\t\tlastProcessedSequenceNumber?: number,\n\t): Promise<void> {\n\t\treturn this._deltaManager.attachOpHandler(\n\t\t\tattributes.minimumSequenceNumber /* minimumSequenceNumber */,\n\t\t\tattributes.sequenceNumber /* snapshotSequenceNumber */,\n\t\t\t{\n\t\t\t\tprocess: (message) => this.processRemoteMessage(message),\n\t\t\t\tprocessSignal: (message) => {\n\t\t\t\t\tthis.processSignal(message);\n\t\t\t\t},\n\t\t\t} /* handler to process incoming delta messages */,\n\t\t\tprefetchType,\n\t\t\tlastProcessedSequenceNumber,\n\t\t);\n\t}\n\n\tprivate logConnectionStateChangeTelemetry(\n\t\tvalue: ConnectionState,\n\t\toldState: ConnectionState,\n\t\treason?: IConnectionStateChangeReason,\n\t): void {\n\t\t// Log actual event\n\t\tconst time = performanceNow();\n\t\tthis.connectionTransitionTimes[value] = time;\n\t\tconst duration = time - this.connectionTransitionTimes[oldState];\n\n\t\tlet durationFromDisconnected: number | undefined;\n\t\tlet autoReconnect: ReconnectMode | undefined;\n\t\tlet checkpointSequenceNumber: number | undefined;\n\t\tlet opsBehind: number | undefined;\n\t\tif (value === ConnectionState.Disconnected) {\n\t\t\tautoReconnect = this._deltaManager.connectionManager.reconnectMode;\n\t\t} else {\n\t\t\tif (value === ConnectionState.Connected) {\n\t\t\t\tdurationFromDisconnected =\n\t\t\t\t\ttime - this.connectionTransitionTimes[ConnectionState.Disconnected];\n\t\t\t\tdurationFromDisconnected = formatTick(durationFromDisconnected);\n\t\t\t} else if (value === ConnectionState.CatchingUp) {\n\t\t\t\t// This info is of most interesting while Catching Up.\n\t\t\t\tcheckpointSequenceNumber = this.deltaManager.lastKnownSeqNumber;\n\t\t\t\t// Need to check that we have already loaded and fetched the snapshot.\n\t\t\t\tif (this.deltaManager.hasCheckpointSequenceNumber && this.loaded) {\n\t\t\t\t\topsBehind = checkpointSequenceNumber - this.deltaManager.lastSequenceNumber;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.mc.logger.sendPerformanceEvent(\n\t\t\t{\n\t\t\t\teventName: `ConnectionStateChange_${ConnectionState[value]}`,\n\t\t\t\tfrom: ConnectionState[oldState],\n\t\t\t\tduration,\n\t\t\t\tdurationFromDisconnected,\n\t\t\t\treason: reason?.text,\n\t\t\t\tconnectionCount: this.connectionCount,\n\t\t\t\tpendingClientId: this.connectionStateHandler.pendingClientId,\n\t\t\t\tclientId: this.connectionStateHandler.clientId,\n\t\t\t\tautoReconnect,\n\t\t\t\topsBehind,\n\t\t\t\tonline: OnlineStatus[isOnline()],\n\t\t\t\tlastVisible:\n\t\t\t\t\tthis.lastVisible === undefined ? undefined : performanceNow() - this.lastVisible,\n\t\t\t\tcheckpointSequenceNumber,\n\t\t\t\tquorumSize: this._protocolHandler?.quorum.getMembers().size,\n\t\t\t\taudienceSize: this._protocolHandler?.audience.getMembers().size,\n\t\t\t\tisDirty: this.isDirty,\n\t\t\t\t...this._deltaManager.connectionProps,\n\t\t\t},\n\t\t\treason?.error,\n\t\t);\n\n\t\tif (value === ConnectionState.Connected) {\n\t\t\tthis.connectionCount++;\n\t\t}\n\t}\n\n\tprivate propagateConnectionState(disconnectedReason?: IConnectionStateChangeReason): void {\n\t\tconst connected = this.connectionState === ConnectionState.Connected;\n\n\t\tif (connected) {\n\t\t\tconst clientId = this.connectionStateHandler.clientId;\n\t\t\tassert(clientId !== undefined, 0x96e /* there has to be clientId */);\n\t\t\tthis.protocolHandler.audience.setCurrentClientId(clientId);\n\t\t\tthis.signalAudience.setCurrentClientId(clientId);\n\t\t} else if (this.connectionState === ConnectionState.CatchingUp) {\n\t\t\t// Signal-based Audience does not wait for ops. So provide clientId\n\t\t\t// as soon as possible.\n\t\t\tconst clientId = this.connectionStateHandler.pendingClientId;\n\t\t\tassert(clientId !== undefined, 0xc89 /* catching up without clientId */);\n\t\t\tthis.signalAudience.setCurrentClientId(clientId);\n\t\t}\n\n\t\tthis.setConnectionStatus(\n\t\t\t/* readonly */ this.readOnlyInfo.readonly ?? false,\n\t\t\t/* onlyCallSetConnectionStateIfConnectedOrDisconnected */ true,\n\t\t);\n\n\t\t// We communicate only transitions to Connected & Disconnected states, skipping all other states.\n\t\t// This can be changed in the future, for example we likely should add \"CatchingUp\" event on Container.\n\t\tif (\n\t\t\tthis.connectionState !== ConnectionState.Connected &&\n\t\t\tthis.connectionState !== ConnectionState.Disconnected\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Both protocol and context should not be undefined if we got so far.\n\n\t\tthis.protocolHandler.setConnectionState(connected, this.clientId);\n\t\traiseConnectedEvent(\n\t\t\tthis.mc.logger,\n\t\t\tthis,\n\t\t\tconnected,\n\t\t\tthis.clientId,\n\t\t\tdisconnectedReason?.text,\n\t\t);\n\t}\n\n\t// back-compat: ADO #1385: Remove in the future, summary op should come through submitSummaryMessage()\n\tprivate submitContainerMessage(\n\t\ttype: MessageType,\n\t\tcontents: unknown,\n\t\tbatch?: boolean,\n\t\tmetadata?: unknown,\n\t): number {\n\t\tswitch (type) {\n\t\t\tcase MessageType.Operation: {\n\t\t\t\treturn this.submitMessage(type, JSON.stringify(contents), batch, metadata);\n\t\t\t}\n\t\t\tcase MessageType.Summarize: {\n\t\t\t\treturn this.submitSummaryMessage(contents as ISummaryContent);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst newError = new GenericError(\n\t\t\t\t\t\"invalidContainerSubmitOpType\",\n\t\t\t\t\tundefined /* error */,\n\t\t\t\t\t{ messageType: type },\n\t\t\t\t);\n\t\t\t\tthis.close(newError);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Gets the `clientSequenceNumber` of last message in a batch.\n\t */\n\tprivate submitBatch(batch: IBatchMessage[], referenceSequenceNumber?: number): number {\n\t\tlet clientSequenceNumber = -1;\n\t\tfor (const message of batch) {\n\t\t\tclientSequenceNumber = this.submitMessage(\n\t\t\t\tMessageType.Operation,\n\t\t\t\tmessage.contents,\n\t\t\t\ttrue, // batch\n\t\t\t\tmessage.metadata,\n\t\t\t\tmessage.compression,\n\t\t\t\treferenceSequenceNumber,\n\t\t\t);\n\t\t}\n\t\tthis._deltaManager.flush();\n\t\treturn clientSequenceNumber;\n\t}\n\n\tprivate submitSummaryMessage(\n\t\tsummary: ISummaryContent,\n\t\treferenceSequenceNumber?: number,\n\t): number {\n\t\t// github #6451: this is only needed for staging so the server\n\t\t// know when the protocol tree is included\n\t\t// this can be removed once all clients send\n\t\t// protocol tree by default\n\t\tif (summary.details === undefined) {\n\t\t\tsummary.details = {};\n\t\t}\n\t\tsummary.details.includesProtocolTree = this.storageAdapter.summarizeProtocolTree;\n\t\treturn this.submitMessage(\n\t\t\tMessageType.Summarize,\n\t\t\tJSON.stringify(summary),\n\t\t\tfalse /* batch */,\n\t\t\tundefined /* metadata */,\n\t\t\tundefined /* compression */,\n\t\t\treferenceSequenceNumber,\n\t\t);\n\t}\n\n\tprivate submitMessage(\n\t\ttype: MessageType,\n\t\tcontents?: string,\n\t\tbatch?: boolean,\n\t\tmetadata?: unknown,\n\t\tcompression?: string,\n\t\treferenceSequenceNumber?: number,\n\t): number {\n\t\tif (this.connectionState !== ConnectionState.Connected) {\n\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"SubmitMessageWithNoConnection\", type });\n\t\t\treturn -1;\n\t\t}\n\n\t\tthis.noopHeuristic?.notifyMessageSent();\n\t\treturn this._deltaManager.submit(\n\t\t\ttype,\n\t\t\tcontents,\n\t\t\tbatch,\n\t\t\tmetadata,\n\t\t\tcompression,\n\t\t\treferenceSequenceNumber,\n\t\t);\n\t}\n\n\t/**\n\t * Processes incoming delta messages\n\t * @param message - delta message received from the server\n\t */\n\tprivate processRemoteMessage(message: ISequencedDocumentMessage): void {\n\t\tconst local = this.clientId === message.clientId;\n\n\t\t// Allow the protocol handler to process the message\n\t\tconst result = this.protocolHandler.processMessage(message, local);\n\n\t\t// Forward messages to the loaded runtime for processing\n\t\tthis.runtime.process(message, local);\n\t\tthis.serializedStateManager.addProcessedOp(message);\n\t\t// Inactive (not in quorum or not writers) clients don't take part in the minimum sequence number calculation.\n\t\tif (this.activeConnection()) {\n\t\t\tif (this.noopHeuristic === undefined) {\n\t\t\t\tconst serviceConfiguration = this.deltaManager.serviceConfiguration;\n\t\t\t\t// Note that config from first connection will be used for this container's lifetime.\n\t\t\t\t// That means that if relay service changes settings, such changes will impact only newly booted\n\t\t\t\t// clients.\n\t\t\t\t// All existing will continue to use settings they got earlier.\n\t\t\t\tassert(\n\t\t\t\t\tserviceConfiguration !== undefined,\n\t\t\t\t\t0x2e4 /* \"there should be service config for active connection\" */,\n\t\t\t\t);\n\t\t\t\tthis.noopHeuristic = new NoopHeuristic(\n\t\t\t\t\tserviceConfiguration.noopTimeFrequency,\n\t\t\t\t\tserviceConfiguration.noopCountFrequency,\n\t\t\t\t);\n\t\t\t\tthis.noopHeuristic.on(\"wantsNoop\", () => {\n\t\t\t\t\t// On disconnect we notify the heuristic which should prevent it from wanting a noop.\n\t\t\t\t\t// Hitting this assert would imply we lost activeConnection between notifying the heuristic of a processed message and\n\t\t\t\t\t// running the microtask that the heuristic queued in response.\n\t\t\t\t\tassert(\n\t\t\t\t\t\tthis.activeConnection(),\n\t\t\t\t\t\t0x241 /* \"Trying to send noop without active connection\" */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.submitMessage(MessageType.NoOp);\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.noopHeuristic.notifyMessageProcessed(message);\n\t\t\t// The contract with the protocolHandler is that returning \"immediateNoOp\" is equivalent to \"please immediately accept the proposal I just processed\".\n\t\t\tif (result.immediateNoOp === true) {\n\t\t\t\tthis.submitMessage(MessageType.Accept);\n\t\t\t}\n\t\t}\n\n\t\tthis.emit(\"op\", message);\n\t}\n\n\t// unknown should be removed once `@alpha` tag is removed from IContainerContext\n\tprivate submitSignal(content: unknown | ISignalEnvelope, targetClientId?: string): void {\n\t\tthis._deltaManager.submitSignal(JSON.stringify(content), targetClientId);\n\t}\n\n\tprivate processSignal(message: ISignalMessage): void {\n\t\t// No clientId indicates a system signal message.\n\t\tif (protocolHandlerShouldProcessSignal(message)) {\n\t\t\tthis.protocolHandler.processSignal(message);\n\t\t} else {\n\t\t\tconst local =\n\t\t\t\t// Check against signal audience to detect current signals\n\t\t\t\t// including very early signals before reaching \"Connected\".\n\t\t\t\tmessage.clientId === this.signalAudience.getSelf()?.clientId ||\n\t\t\t\t// and use \"regular\" audience to detect signals from past\n\t\t\t\t// connection bouncing slowly back from service. This may never\n\t\t\t\t// happen, but is kept as it was used historically as the only\n\t\t\t\t// check.\n\t\t\t\tmessage.clientId === this.clientId;\n\t\t\tthis.runtime.processSignal(message, local);\n\t\t}\n\t}\n\n\tprivate async instantiateRuntime(\n\t\tcodeDetails: IFluidCodeDetails,\n\t\tsnapshotTree: ISnapshotTree | undefined,\n\t\tpendingLocalState?: unknown,\n\t\tsnapshot?: ISnapshot,\n\t): Promise<void> {\n\t\tassert(this._runtime?.disposed !== false, 0x0dd /* \"Existing runtime not disposed\" */);\n\n\t\ttry {\n\t\t\t// The relative loader will proxy requests to '/' to the loader itself assuming no non-cache flags\n\t\t\t// are set. Global requests will still go directly to the loader\n\t\t\tconst maybeLoader: FluidObject<ILoader> = this.scope;\n\t\t\tconst loader = new RelativeLoader(this, maybeLoader.ILoader);\n\n\t\t\tconst loadCodeResult = await PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.subLogger,\n\t\t\t\t{ eventName: \"CodeLoad\" },\n\t\t\t\tasync () => this.codeLoader.load(codeDetails),\n\t\t\t);\n\n\t\t\tthis._loadedModule = {\n\t\t\t\tmodule: loadCodeResult.module,\n\t\t\t\t// An older interface ICodeLoader could return an IFluidModule which didn't have details.\n\t\t\t\t// If we're using one of those older ICodeLoaders, then we fix up the module with the specified details here.\n\t\t\t\t// TODO: Determine if this is still a realistic scenario or if this fixup could be removed.\n\t\t\t\tdetails: loadCodeResult.details ?? codeDetails,\n\t\t\t};\n\n\t\t\tconst fluidExport: FluidObject<IProvideRuntimeFactory> | undefined =\n\t\t\t\tthis._loadedModule.module.fluidExport;\n\t\t\tconst runtimeFactory = fluidExport?.IRuntimeFactory;\n\t\t\tif (runtimeFactory === undefined) {\n\t\t\t\tthrow new Error(packageNotFactoryError);\n\t\t\t}\n\n\t\t\tconst existing = snapshotTree !== undefined;\n\n\t\t\tconst context = new ContainerContext({\n\t\t\t\toptions: this.options,\n\t\t\t\tscope: this.scope,\n\t\t\t\tbaseSnapshot: snapshotTree,\n\t\t\t\tversion: this._loadedFromVersion,\n\t\t\t\tdeltaManager: this._deltaManager,\n\t\t\t\tstorage: this.storageAdapter,\n\t\t\t\tquorum: this.protocolHandler.quorum,\n\t\t\t\taudience: this.protocolHandler.audience,\n\t\t\t\tsignalAudience: this.signalAudience,\n\t\t\t\tloader,\n\t\t\t\tsubmitFn: (type, contents, batch, metadata) =>\n\t\t\t\t\tthis.submitContainerMessage(type, contents, batch, metadata),\n\t\t\t\tsubmitSummaryFn: (summaryOp: ISummaryContent, referenceSequenceNumber?: number) =>\n\t\t\t\t\tthis.submitSummaryMessage(summaryOp, referenceSequenceNumber),\n\t\t\t\tsubmitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) =>\n\t\t\t\t\tthis.submitBatch(batch, referenceSequenceNumber),\n\t\t\t\tsubmitSignalFn: (content, targetClientId) =>\n\t\t\t\t\tthis.submitSignal(content, targetClientId),\n\t\t\t\tdisposeFn: (error?: ICriticalContainerError) => this.dispose(error),\n\t\t\t\tcloseFn: (error?: ICriticalContainerError) => this.close(error),\n\t\t\t\tupdateDirtyContainerState: this.updateDirtyContainerState,\n\t\t\t\tgetAbsoluteUrl: this.getAbsoluteUrl,\n\t\t\t\tgetContainerDiagnosticId: () => this.resolvedUrl?.id,\n\t\t\t\tgetClientId: () => this.clientId,\n\t\t\t\tgetAttachState: () => this.attachState,\n\t\t\t\tgetConnected: () => this.connected,\n\t\t\t\tgetConnectionState: () => this.connectionState,\n\t\t\t\tclientDetails: this._deltaManager.clientDetails,\n\t\t\t\texisting,\n\t\t\t\ttaggedLogger: this.subLogger,\n\t\t\t\tpendingLocalState,\n\t\t\t\tsnapshotWithContents: snapshot,\n\t\t\t});\n\n\t\t\tconst runtime = await PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.subLogger,\n\t\t\t\t{ eventName: \"InstantiateRuntime\" },\n\t\t\t\tasync () => runtimeFactory.instantiateRuntime(context, existing),\n\t\t\t);\n\n\t\t\t// Validate that the Runtime is compatible with this Loader.\n\t\t\tconst maybeRuntimeCompatDetails = runtime as FluidObject<ILayerCompatDetails>;\n\t\t\tvalidateRuntimeCompatibility(\n\t\t\t\tmaybeRuntimeCompatDetails.ILayerCompatDetails,\n\t\t\t\tthis.mc.logger,\n\t\t\t);\n\n\t\t\tthis._runtime = runtime;\n\t\t\tthis._lifecycleEvents.emit(\"runtimeInstantiated\");\n\t\t\tthis._loadedCodeDetails = codeDetails;\n\t\t} catch (error) {\n\t\t\tthis.dispose(normalizeError(error));\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprivate readonly updateDirtyContainerState = (dirty: boolean): void => {\n\t\tif (this._dirtyContainer === dirty) {\n\t\t\treturn;\n\t\t}\n\t\tthis._dirtyContainer = dirty;\n\t\tthis.emit(dirty ? dirtyContainerEvent : savedContainerEvent);\n\t};\n\n\t/**\n\t * Send the connected status to the runtime.\n\t * @param readonly - Is the container in readonly mode?\n\t * @param onlyCallSetConnectionStateIfConnectedOrDisconnected - If true, only\n\t * call older `setConnectionState` on the runtime if the connection state is\n\t * either Connected or Disconnected. This exists to preserve older behavior\n\t * where the runtime was only notified of these two states.\n\t */\n\tprivate setConnectionStatus(\n\t\treadonly: boolean,\n\t\tonlyCallSetConnectionStateIfConnectedOrDisconnected: boolean = false,\n\t): void {\n\t\tif (this._runtime?.disposed === false && this.loaded) {\n\t\t\tconst setConnectionStatus = this.runtime.setConnectionStatus?.bind(this.runtime);\n\t\t\tif (setConnectionStatus === undefined) {\n\t\t\t\tif (\n\t\t\t\t\t!onlyCallSetConnectionStateIfConnectedOrDisconnected ||\n\t\t\t\t\tthis.connectionState === ConnectionState.Connected ||\n\t\t\t\t\tthis.connectionState === ConnectionState.Disconnected\n\t\t\t\t) {\n\t\t\t\t\tthis.runtime.setConnectionState(\n\t\t\t\t\t\tthis.connectionState === ConnectionState.Connected &&\n\t\t\t\t\t\t\t!readonly /* container can send ops if connected to service and not in readonly mode */,\n\t\t\t\t\t\tthis.clientId,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst pendingClientConnectionId = this.connectionStateHandler.pendingClientId;\n\t\t\t\tconst connectionState = this.connectionState;\n\t\t\t\tswitch (connectionState) {\n\t\t\t\t\tcase ConnectionState.EstablishingConnection: {\n\t\t\t\t\t\tsetConnectionStatus({\n\t\t\t\t\t\t\tconnectionState,\n\t\t\t\t\t\t\tcanSendOps: false,\n\t\t\t\t\t\t\treadonly,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase ConnectionState.CatchingUp: {\n\t\t\t\t\t\t// When catching up, we have a pending clientId, but it\n\t\t\t\t\t\t// is not usable for ops. Send clientId with canSendOps false.\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tpendingClientConnectionId !== undefined,\n\t\t\t\t\t\t\t0xc8a /* catching up without clientId */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tsetConnectionStatus({\n\t\t\t\t\t\t\tconnectionState,\n\t\t\t\t\t\t\tpendingClientConnectionId,\n\t\t\t\t\t\t\tcanSendOps: false,\n\t\t\t\t\t\t\treadonly,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase ConnectionState.Connected: {\n\t\t\t\t\t\t// When connected, we have an active clientId. Pass it along\n\t\t\t\t\t\t// with canSendOps true/false based on readonly.\n\t\t\t\t\t\tconst clientConnectionId = this.clientId;\n\t\t\t\t\t\tassert(clientConnectionId !== undefined, 0xc8b /* connected without clientId */);\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tclientConnectionId === pendingClientConnectionId,\n\t\t\t\t\t\t\t0xc8c /* connected with different clientId than pending */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tsetConnectionStatus({\n\t\t\t\t\t\t\tconnectionState,\n\t\t\t\t\t\t\tclientConnectionId,\n\t\t\t\t\t\t\tcanSendOps: !readonly,\n\t\t\t\t\t\t\treadonly,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase ConnectionState.Disconnected: {\n\t\t\t\t\t\tsetConnectionStatus({\n\t\t\t\t\t\t\tconnectionState,\n\t\t\t\t\t\t\tpriorPendingClientConnectionId: pendingClientConnectionId,\n\t\t\t\t\t\t\tpriorConnectedClientConnectionId: this.clientId,\n\t\t\t\t\t\t\tcanSendOps: false,\n\t\t\t\t\t\t\treadonly,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t// No default\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate handleDeltaConnectionArg(\n\t\tdeltaConnectionArg?: \"none\" | \"delayed\",\n\t\tconnectionArgs?: IConnectionArgs,\n\t): void {\n\t\t// This ensures that we allow transitions to \"connected\" state only after container has been fully loaded\n\t\t// and we propagate such events to container runtime. All events prior to being loaded are ignored.\n\t\t// This means if we get here in non-loaded state, we might not deliver proper events to container runtime,\n\t\t// and runtime implementation may miss such events.\n\t\tassert(\n\t\t\tthis.loaded,\n\t\t\t0x96f /* has to be called after container transitions to loaded state */,\n\t\t);\n\n\t\tswitch (deltaConnectionArg) {\n\t\t\tcase undefined: {\n\t\t\t\tif (connectionArgs) {\n\t\t\t\t\t// connect to delta stream now since we did not before\n\t\t\t\t\tthis.connectToDeltaStream(connectionArgs);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// intentional fallthrough\n\t\t\tcase \"delayed\": {\n\t\t\t\tassert(\n\t\t\t\t\tthis.inboundQueuePausedFromInit,\n\t\t\t\t\t0x346 /* inboundQueuePausedFromInit should be true */,\n\t\t\t\t);\n\t\t\t\tthis.inboundQueuePausedFromInit = false;\n\t\t\t\tthis._deltaManager.inbound.resume();\n\t\t\t\tthis._deltaManager.inboundSignal.resume();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"none\": {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(deltaConnectionArg);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * IContainer interface that includes experimental features still under development.\n * @alpha @legacy @sealed\n */\nexport interface ContainerAlpha extends IContainer {\n\t/**\n\t * Get pending state from container. WARNING: misuse of this API can result in duplicate op\n\t * submission and potential document corruption. The blob returned MUST be deleted if and when this\n\t * container emits a \"connected\" event.\n\t * @returns serialized blob that can be passed to Loader.resolve()\n\t */\n\tgetPendingLocalState(): Promise<string>;\n}\n\n/**\n * Converts types to their alpha counterparts to expose alpha functionality.\n * @legacy @alpha\n */\nexport function asLegacyAlpha(base: IContainer): ContainerAlpha {\n\treturn base as ContainerAlpha;\n}\n"]}
1
+ {"version":3,"file":"container.js","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,wDAAwD;AAExD,+DAIsC;AACtC,iFAI+C;AAoB/C,6EAAoF;AACpF,qEAMyC;AAEzC,kEAA6F;AAC7F,2EAO4C;AAC5C,0EAmBqD;AACrD,oEAS+C;AAC/C,uEAkBkD;AAClD,+EAAsD;AACtD,+BAAkC;AAElC,mDAIyB;AACzB,+CAAyC;AACzC,iEAA2D;AAC3D,6DAAuD;AACvD,2EAGqC;AACrC,+DAAyD;AACzD,6EAAuE;AACvE,iDAMwB;AACxB,uDAAuE;AAEvE,2CAA6C;AAC7C,2EAGqC;AACrC,iEAIgC;AAChC,yDAAmD;AACnD,2DAAiD;AAEjD,+CAMuB;AACvB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IAAI,CAAC,QAAQ;4BAC/C,UAAU,EAAE,KAAK;4BACjB,QAAQ;yBACR,CAAC,CAAC;wBAEH,MAAM;oBACP,CAAC;oBACD,aAAa;gBACd,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAEO,wBAAwB,CAC/B,kBAAuC,EACvC,cAAgC;QAEhC,yGAAyG;QACzG,mGAAmG;QACnG,0GAA0G;QAC1G,mDAAmD;QACnD,IAAA,iBAAM,EACL,IAAI,CAAC,MAAM,EACX,KAAK,CAAC,kEAAkE,CACxE,CAAC;QAEF,QAAQ,kBAAkB,EAAE,CAAC;YAC5B,KAAK,SAAS,CAAC,CAAC,CAAC;gBAChB,IAAI,cAAc,EAAE,CAAC;oBACpB,sDAAsD;oBACtD,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;gBAC3C,CAAC;YACF,CAAC;YACD,0BAA0B;YAC1B,KAAK,SAAS,CAAC,CAAC,CAAC;gBAChB,IAAA,iBAAM,EACL,IAAI,CAAC,0BAA0B,EAC/B,KAAK,CAAC,+CAA+C,CACrD,CAAC;gBACF,IAAI,CAAC,0BAA0B,GAAG,KAAK,CAAC;gBACxC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBACpC,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;gBAC1C,MAAM;YACP,CAAC;YACD,KAAK,MAAM,CAAC,CAAC,CAAC;gBACb,MAAM;YACP,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACT,IAAA,0BAAe,EAAC,kBAAkB,CAAC,CAAC;YACrC,CAAC;QACF,CAAC;IACF,CAAC;CACD;AAruED,8BAquEC;AAgBD;;;GAGG;AACH,SAAgB,aAAa,CAAC,IAAgB;IAC7C,OAAO,IAAsB,CAAC;AAC/B,CAAC;AAFD,sCAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable unicorn/consistent-function-scoping */\n\nimport {\n\tTypedEventEmitter,\n\tperformanceNow,\n\ttype ILayerCompatDetails,\n} from \"@fluid-internal/client-utils\";\nimport {\n\tAttachState,\n\ttype IAudience,\n\ttype ICriticalContainerError,\n} from \"@fluidframework/container-definitions\";\nimport type {\n\tContainerWarning,\n\tIBatchMessage,\n\tICodeDetailsLoader,\n\tIContainer,\n\tIContainerEvents,\n\tIContainerLoadMode,\n\tIDeltaManager,\n\tIFluidCodeDetails,\n\tIFluidCodeDetailsComparer,\n\tIFluidModuleWithDetails,\n\tIProvideFluidCodeDetailsComparer,\n\tIProvideRuntimeFactory,\n\tIRuntime,\n\tReadOnlyInfo,\n\tILoader,\n\tILoaderOptions,\n\tIContainerStorageService,\n} from \"@fluidframework/container-definitions/internal\";\nimport { isFluidCodeDetails } from \"@fluidframework/container-definitions/internal\";\nimport {\n\ttype FluidObject,\n\ttype IEvent,\n\ttype IRequest,\n\ttype ITelemetryBaseProperties,\n\tLogLevel,\n} from \"@fluidframework/core-interfaces\";\nimport type { ISignalEnvelope } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, isPromiseLike, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype IClient,\n\ttype IClientDetails,\n\ttype IQuorumClients,\n\ttype ISequencedClient,\n\ttype ISummaryTree,\n\tSummaryType,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\ttype IDocumentService,\n\ttype IDocumentServiceFactory,\n\ttype IResolvedUrl,\n\ttype ISnapshot,\n\ttype IThrottlingWarning,\n\ttype IUrlResolver,\n\ttype ICommittedProposal,\n\ttype IDocumentAttributes,\n\ttype IDocumentMessage,\n\ttype IQuorumProposals,\n\ttype ISequencedProposal,\n\ttype ISnapshotTree,\n\ttype ISummaryContent,\n\ttype IVersion,\n\tMessageType,\n\ttype ISequencedDocumentMessage,\n\ttype ISignalMessage,\n\ttype ConnectionMode,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tgetSnapshotTree,\n\tOnlineStatus,\n\tisCombinedAppAndProtocolSummary,\n\tisInstanceOfISnapshot,\n\tisOnline,\n\treadAndParse,\n\trunWithRetry,\n\ttype CombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype TelemetryEventCategory,\n\ttype ITelemetryLoggerExt,\n\tEventEmitterWithErrorHandling,\n\tGenericError,\n\ttype IFluidErrorBase,\n\ttype MonitoringContext,\n\tPerformanceEvent,\n\tUsageError,\n\tconnectedEventName,\n\tcreateChildLogger,\n\tcreateChildMonitoringContext,\n\tformatTick,\n\tnormalizeError,\n\traiseConnectedEvent,\n\twrapError,\n\tloggerToMonitoringContext,\n\ttype ITelemetryErrorEventExt,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport structuredClone from \"@ungap/structured-clone\";\nimport { v4 as uuid } from \"uuid\";\n\nimport {\n\ttype AttachProcessProps,\n\ttype AttachmentData,\n\trunRetriableAttachProcess,\n} from \"./attachment.js\";\nimport { Audience } from \"./audience.js\";\nimport { ConnectionManager } from \"./connectionManager.js\";\nimport { ConnectionState } from \"./connectionState.js\";\nimport {\n\ttype IConnectionStateHandler,\n\tcreateConnectionStateHandler,\n} from \"./connectionStateHandler.js\";\nimport { ContainerContext } from \"./containerContext.js\";\nimport { ContainerStorageAdapter } from \"./containerStorageAdapter.js\";\nimport {\n\ttype IConnectionDetailsInternal,\n\ttype IConnectionManagerFactoryArgs,\n\ttype IConnectionStateChangeReason,\n\tReconnectMode,\n\tgetPackageName,\n} from \"./contracts.js\";\nimport { DeltaManager, type IConnectionArgs } from \"./deltaManager.js\";\nimport type { ILoaderServices } from \"./loader.js\";\nimport { RelativeLoader } from \"./loader.js\";\nimport {\n\tvalidateDriverCompatibility,\n\tvalidateRuntimeCompatibility,\n} from \"./loaderLayerCompatState.js\";\nimport {\n\tcreateMemoryDetachedBlobStorage,\n\ttryInitializeMemoryDetachedBlobStorage,\n\ttype MemoryDetachedBlobStorage,\n} from \"./memoryBlobStorage.js\";\nimport { NoopHeuristic } from \"./noopHeuristic.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\nimport type { IQuorumSnapshot } from \"./protocol/index.js\";\nimport {\n\ttype InternalProtocolHandlerBuilder,\n\tProtocolHandler,\n\ttype ProtocolHandlerInternal,\n\tprotocolHandlerShouldProcessSignal,\n\twrapProtocolHandlerBuilder,\n} from \"./protocol.js\";\nimport { initQuorumValuesFromCodeDetails } from \"./quorum.js\";\nimport {\n\ttype IPendingContainerState,\n\ttype IPendingDetachedContainerState,\n\tSerializedStateManager,\n} from \"./serializedStateManager.js\";\nimport {\n\tcombineAppAndProtocolSummary,\n\tcombineSnapshotTreeAndSnapshotBlobs,\n\tgetDetachedContainerStateFromSerializedContainer,\n\tgetDocumentAttributes,\n\tgetProtocolSnapshotTree,\n\tgetISnapshotFromSerializedContainer,\n\trunSingle,\n\tconvertISnapshotToSnapshotWithBlobs,\n\tconvertSnapshotInfoToSnapshot,\n} from \"./utils.js\";\n\nconst detachedContainerRefSeqNumber = 0;\n\nconst dirtyContainerEvent = \"dirty\";\nconst savedContainerEvent = \"saved\";\n\nconst packageNotFactoryError = \"Code package does not implement IRuntimeFactory\";\n\n/**\n * @remarks Export for testing only\n * @internal\n */\nexport interface IContainerLoadProps {\n\t/**\n\t * The resolved url of the container being loaded\n\t */\n\treadonly resolvedUrl: IResolvedUrl;\n\t/**\n\t * Control which snapshot version to load from. See IParsedUrl for detailed information.\n\t */\n\treadonly version: string | undefined;\n\t/**\n\t * Loads the Container in paused state if true, unpaused otherwise.\n\t */\n\treadonly loadMode?: IContainerLoadMode;\n\n\t/**\n\t * The pending state serialized from a previous container instance\n\t */\n\treadonly pendingLocalState?: IPendingContainerState;\n}\n\n/**\n * @remarks Export for testing only\n * @internal\n */\nexport interface IContainerCreateProps extends ILoaderServices {\n\t/**\n\t * Disables the Container from reconnecting if false, allows reconnect otherwise.\n\t */\n\treadonly canReconnect?: boolean;\n\t/**\n\t * Client details provided in the override will be merged over the default client.\n\t */\n\treadonly clientDetailsOverride?: IClientDetails;\n}\n\n/**\n * Waits until container connects to delta storage and gets up-to-date.\n *\n * Useful when resolving URIs and hitting 404, due to container being loaded from (stale) snapshot and not being\n * up to date. Host may chose to wait in such case and retry resolving URI.\n *\n * Warning: Will wait infinitely for connection to establish if there is no connection.\n * May result in deadlock if Container.disconnect() is called and never followed by a call to Container.connect().\n *\n * @returns `true`: container is up to date, it processed all the ops that were know at the time of first connection.\n *\n * `false`: storage does not provide indication of how far the client is. Container processed all the ops known to it,\n * but it maybe still behind.\n *\n * @throws an error beginning with `\"Container closed\"` if the container is closed before it catches up.\n * @legacy @beta\n */\nexport async function waitContainerToCatchUp(container: IContainer): Promise<boolean> {\n\t// Make sure we stop waiting if container is closed.\n\tif (container.closed) {\n\t\tthrow new UsageError(\"waitContainerToCatchUp: Container closed\");\n\t}\n\n\treturn new Promise<boolean>((resolve, reject) => {\n\t\tconst deltaManager = container.deltaManager;\n\n\t\tconst closedCallback = (err?: ICriticalContainerError | undefined): void => {\n\t\t\tcontainer.off(\"closed\", closedCallback);\n\t\t\tconst baseMessage = \"Container closed while waiting to catch up\";\n\t\t\treject(\n\t\t\t\terr === undefined\n\t\t\t\t\t? new GenericError(baseMessage)\n\t\t\t\t\t: wrapError(\n\t\t\t\t\t\t\terr,\n\t\t\t\t\t\t\t(innerMessage) => new GenericError(`${baseMessage}: ${innerMessage}`),\n\t\t\t\t\t\t),\n\t\t\t);\n\t\t};\n\t\tcontainer.on(\"closed\", closedCallback);\n\n\t\t// Depending on config, transition to \"connected\" state may include the guarantee\n\t\t// that all known ops have been processed. If so, we may introduce additional wait here.\n\t\t// Waiting for \"connected\" state in either case gets us at least to our own Join op\n\t\t// which is a reasonable approximation of \"caught up\"\n\t\tconst waitForOps = (): void => {\n\t\t\tassert(\n\t\t\t\tcontainer.connectionState === ConnectionState.CatchingUp ||\n\t\t\t\t\tcontainer.connectionState === ConnectionState.Connected,\n\t\t\t\t0x0cd /* \"Container disconnected while waiting for ops!\" */,\n\t\t\t);\n\t\t\tconst hasCheckpointSequenceNumber = deltaManager.hasCheckpointSequenceNumber;\n\n\t\t\tconst connectionOpSeqNumber = deltaManager.lastKnownSeqNumber;\n\t\t\tassert(\n\t\t\t\tdeltaManager.lastSequenceNumber <= connectionOpSeqNumber,\n\t\t\t\t0x266 /* \"lastKnownSeqNumber should never be below last processed sequence number\" */,\n\t\t\t);\n\t\t\tif (deltaManager.lastSequenceNumber === connectionOpSeqNumber) {\n\t\t\t\tcontainer.off(\"closed\", closedCallback);\n\t\t\t\tresolve(hasCheckpointSequenceNumber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst callbackOps = (message: ISequencedDocumentMessage): void => {\n\t\t\t\tif (connectionOpSeqNumber <= message.sequenceNumber) {\n\t\t\t\t\tcontainer.off(\"closed\", closedCallback);\n\t\t\t\t\tresolve(hasCheckpointSequenceNumber);\n\t\t\t\t\tdeltaManager.off(\"op\", callbackOps);\n\t\t\t\t}\n\t\t\t};\n\t\t\tdeltaManager.on(\"op\", callbackOps);\n\t\t};\n\n\t\t// We can leverage DeltaManager's \"connect\" event here and test for ConnectionState.Disconnected\n\t\t// But that works only if service provides us checkPointSequenceNumber\n\t\t// Our internal testing is based on R11S that does not, but almost all tests connect as \"write\" and\n\t\t// use this function to catch up, so leveraging our own join op as a fence/barrier\n\t\tif (container.connectionState === ConnectionState.Connected) {\n\t\t\twaitForOps();\n\t\t\treturn;\n\t\t}\n\n\t\tconst callback = (): void => {\n\t\t\tcontainer.off(connectedEventName, callback);\n\t\t\twaitForOps();\n\t\t};\n\t\tcontainer.on(connectedEventName, callback);\n\n\t\tif (container.connectionState === ConnectionState.Disconnected) {\n\t\t\tcontainer.connect();\n\t\t}\n\t});\n}\n\nconst getCodeProposal = (quorum: IQuorumProposals): unknown =>\n\tquorum.get(\"code\") ?? quorum.get(\"code2\");\n\nconst summarizerClientType = \"summarizer\";\n\ninterface IContainerLifecycleEvents extends IEvent {\n\t(event: \"runtimeInstantiated\", listener: () => void): void;\n\t(event: \"disposed\", listener: () => void): void;\n}\n\nexport class Container\n\textends EventEmitterWithErrorHandling<IContainerEvents>\n\timplements IContainer, ContainerAlpha\n{\n\t/**\n\t * Load an existing container.\n\t */\n\tpublic static async load(\n\t\tloadProps: IContainerLoadProps,\n\t\tcreateProps: IContainerCreateProps,\n\t): Promise<Container> {\n\t\tconst { version, pendingLocalState, loadMode, resolvedUrl } = loadProps;\n\n\t\tconst container = new Container(createProps, loadProps);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tcontainer.mc.logger,\n\t\t\t{ eventName: \"Load\", ...loadMode },\n\t\t\tasync (event) =>\n\t\t\t\tnew Promise<Container>((resolve, reject) => {\n\t\t\t\t\tconst defaultMode: IContainerLoadMode = { opsBeforeReturn: \"cached\" };\n\t\t\t\t\t// if we have pendingLocalState, anything we cached is not useful and we shouldn't wait for connection\n\t\t\t\t\t// to return container, so ignore this value and use undefined for opsBeforeReturn\n\t\t\t\t\tconst mode: IContainerLoadMode = pendingLocalState\n\t\t\t\t\t\t? { ...(loadMode ?? defaultMode), opsBeforeReturn: undefined }\n\t\t\t\t\t\t: (loadMode ?? defaultMode);\n\n\t\t\t\t\tconst onClosed = (err?: ICriticalContainerError): void => {\n\t\t\t\t\t\t// pre-0.58 error message: containerClosedWithoutErrorDuringLoad\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\t\t\treject(err ?? new GenericError(\"Container closed without error during load\"));\n\t\t\t\t\t};\n\t\t\t\t\tcontainer.on(\"closed\", onClosed);\n\n\t\t\t\t\tcontainer\n\t\t\t\t\t\t.load(version, mode, resolvedUrl, pendingLocalState)\n\t\t\t\t\t\t.finally(() => {\n\t\t\t\t\t\t\tcontainer.removeListener(\"closed\", onClosed);\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.then(\n\t\t\t\t\t\t\t(props) => {\n\t\t\t\t\t\t\t\tevent.end({ ...props });\n\t\t\t\t\t\t\t\tresolve(container);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t(error) => {\n\t\t\t\t\t\t\t\tconst err = normalizeError(error);\n\t\t\t\t\t\t\t\t// Depending where error happens, we can be attempting to connect to web socket\n\t\t\t\t\t\t\t\t// and continuously retrying (consider offline mode)\n\t\t\t\t\t\t\t\t// Host has no container to close, so it's prudent to do it here\n\t\t\t\t\t\t\t\t// Note: We could only dispose the container instead of just close but that would\n\t\t\t\t\t\t\t\t// the telemetry where users sometimes search for ContainerClose event to look\n\t\t\t\t\t\t\t\t// for load failures. So not removing this at this time.\n\t\t\t\t\t\t\t\tcontainer.close(err);\n\t\t\t\t\t\t\t\tcontainer.dispose(err);\n\t\t\t\t\t\t\t\tonClosed(err);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t);\n\t\t\t\t}),\n\t\t\t{ start: true, end: true, cancel: \"generic\" },\n\t\t);\n\t}\n\n\t/**\n\t * Create a new container in a detached state.\n\t */\n\tpublic static async createDetached(\n\t\tcreateProps: IContainerCreateProps,\n\t\tcodeDetails: IFluidCodeDetails,\n\t): Promise<Container> {\n\t\tconst container = new Container(createProps);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tcontainer.mc.logger,\n\t\t\t{ eventName: \"CreateDetached\" },\n\t\t\tasync (_event) => {\n\t\t\t\tawait container.createDetached(codeDetails);\n\t\t\t\treturn container;\n\t\t\t},\n\t\t\t{ start: true, end: true, cancel: \"generic\" },\n\t\t);\n\t}\n\n\t/**\n\t * Create a new container in a detached state that is initialized with a\n\t * snapshot from a previous detached container.\n\t * @param createProps - Config options for this new container instance\n\t * @param snapshot - A stringified {@link IPendingDetachedContainerState}, e.g. generated via {@link serialize}\n\t */\n\tpublic static async rehydrateDetachedFromSnapshot(\n\t\tcreateProps: IContainerCreateProps,\n\t\tsnapshot: string,\n\t): Promise<Container> {\n\t\tconst container = new Container(createProps);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tcontainer.mc.logger,\n\t\t\t{ eventName: \"RehydrateDetachedFromSnapshot\" },\n\t\t\tasync (_event) => {\n\t\t\t\tconst detachedContainerState: IPendingDetachedContainerState =\n\t\t\t\t\tgetDetachedContainerStateFromSerializedContainer(snapshot);\n\t\t\t\tawait container.rehydrateDetachedFromSnapshot(detachedContainerState);\n\t\t\t\treturn container;\n\t\t\t},\n\t\t\t{ start: true, end: true, cancel: \"generic\" },\n\t\t);\n\t}\n\n\t// Tells if container can reconnect on losing fist connection\n\t// If false, container gets closed on loss of connection.\n\tprivate readonly _canReconnect: boolean;\n\tprivate readonly clientDetailsOverride: IClientDetails | undefined;\n\tprivate readonly urlResolver: IUrlResolver;\n\tprivate readonly serviceFactory: IDocumentServiceFactory;\n\tprivate readonly codeLoader: ICodeDetailsLoader;\n\tprivate readonly options: ILoaderOptions;\n\tprivate readonly scope: FluidObject;\n\tprivate readonly subLogger: ITelemetryLoggerExt;\n\tprivate readonly detachedBlobStorage: MemoryDetachedBlobStorage | undefined;\n\tprivate readonly protocolHandlerBuilder: InternalProtocolHandlerBuilder;\n\tprivate readonly signalAudience = new Audience();\n\tprivate readonly client: IClient;\n\n\tprivate readonly mc: MonitoringContext;\n\n\t/**\n\t * Used by the RelativeLoader to spawn a new Container for the same document. Used to create the summarizing client.\n\t */\n\tpublic readonly clone: (\n\t\tloadProps: IContainerLoadProps,\n\t\tcreateParamOverrides: Partial<IContainerCreateProps>,\n\t) => Promise<Container>;\n\n\t/**\n\t * Lifecycle state of the container, used mainly to prevent re-entrancy and telemetry\n\t *\n\t * States are allowed to progress to further states:\n\t * \"loading\" - \"loaded\" - \"closing\" - \"disposing\" - \"closed\" - \"disposed\"\n\t *\n\t * For example, moving from \"closed\" to \"disposing\" is not allowed since it is an earlier state.\n\t *\n\t * loading: Container has been created, but is not yet in normal/loaded state\n\t * loaded: Container is in normal/loaded state\n\t * closing: Container has started closing process (for re-entrancy prevention)\n\t * disposing: Container has started disposing process (for re-entrancy prevention)\n\t * closed: Container has closed\n\t * disposed: Container has been disposed\n\t */\n\tprivate _lifecycleState:\n\t\t| \"loading\"\n\t\t| \"loaded\"\n\t\t| \"closing\"\n\t\t| \"disposing\"\n\t\t| \"closed\"\n\t\t| \"disposed\" = \"loading\";\n\n\tprivate setLoaded(): void {\n\t\t// It's conceivable the container could be closed when this is called\n\t\t// Only transition states if currently loading\n\t\tif (this._lifecycleState === \"loading\") {\n\t\t\tthis._lifecycleState = \"loaded\";\n\n\t\t\t// Connections transitions are delayed till we are loaded.\n\t\t\t// This is done by holding ops and signals until the end of load sequence\n\t\t\t// (calling this.handleDeltaConnectionArg() after setLoaded() call)\n\t\t\t// If this assert fires, it means our logic managing connection flow is wrong, and the logic below is also wrong.\n\t\t\tassert(\n\t\t\t\tthis.connectionState !== ConnectionState.Connected,\n\t\t\t\t0x969 /* not connected yet */,\n\t\t\t);\n\n\t\t\t// Track membership changes and update connection state accordingly\n\t\t\t// We do this call here, instead of doing it in initializeProtocolState() due to pendingLocalState.\n\t\t\t// When we load from stashed state, we let connectionStateHandler know about clientId from previous container instance.\n\t\t\t// But we will play trailing ops from snapshot, including potentially playing join & leave ops for that same clientId!\n\t\t\t// In other words, if connectionStateHandler has access to Quorum early in load sequence, it will see events (in stashed ops mode)\n\t\t\t// in the order that is not possible in real life, that it may not expect.\n\t\t\t// Ideally, we should supply pendingLocalState?.clientId here as well, not in constructor, but it does not matter (at least today)\n\t\t\tthis.connectionStateHandler.initProtocol(this.protocolHandler);\n\n\t\t\t// This call does not look like needed any more, with delaying all connection-related events past loaded phase.\n\t\t\t// Yet, there could be some customer code that would break if we do not deliver it.\n\t\t\t// Will be removed in further PRs with proper changeset.\n\t\t\tconst runtime = this._runtime;\n\t\t\tif (\n\t\t\t\truntime !== undefined &&\n\t\t\t\t// Check for older runtime that may need this call\n\t\t\t\t!(\"setConnectionStatus\" in runtime) &&\n\t\t\t\truntime.disposed === false\n\t\t\t) {\n\t\t\t\truntime.setConnectionState(false /* canSendOps */, this.clientId);\n\t\t\t}\n\n\t\t\t// Deliver delayed calls to DeltaManager - we ignored \"connect\" events while loading.\n\t\t\tconst cm = this._deltaManager.connectionManager;\n\t\t\tif (cm.connected) {\n\t\t\t\tconst details = cm.connectionDetails;\n\t\t\t\tassert(details !== undefined, 0x96a /* should have details if connected */);\n\t\t\t\tthis.connectionStateHandler.receivedConnectEvent(details);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic get closed(): boolean {\n\t\treturn (\n\t\t\tthis._lifecycleState === \"closing\" || this._lifecycleState === \"closed\" || this.disposed\n\t\t);\n\t}\n\n\tprotected get loaded(): boolean {\n\t\treturn this._lifecycleState === \"loaded\";\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this._lifecycleState === \"disposing\" || this._lifecycleState === \"disposed\";\n\t}\n\n\tprivate readonly storageAdapter: ContainerStorageAdapter;\n\n\tprivate readonly _deltaManager: DeltaManager<ConnectionManager>;\n\tprivate service: IDocumentService | undefined;\n\n\tprivate _runtime: IRuntime | undefined;\n\tprivate get runtime(): IRuntime {\n\t\tif (this._runtime === undefined) {\n\t\t\tthrow new Error(\"Attempted to access runtime before it was defined\");\n\t\t}\n\t\treturn this._runtime;\n\t}\n\tprivate _protocolHandler: ProtocolHandlerInternal | undefined;\n\tprivate get protocolHandler(): ProtocolHandlerInternal {\n\t\tif (this._protocolHandler === undefined) {\n\t\t\tthrow new Error(\"Attempted to access protocolHandler before it was defined\");\n\t\t}\n\t\treturn this._protocolHandler;\n\t}\n\n\t/**\n\t * During initialization we pause the inbound queues. We track this state to ensure we only call resume once\n\t */\n\tprivate inboundQueuePausedFromInit = true;\n\tprivate connectionCount = 0;\n\tprivate readonly connectionTransitionTimes: number[] = [];\n\tprivate _loadedFromVersion: IVersion | undefined;\n\tprivate _dirtyContainer = false;\n\tprivate attachmentData: AttachmentData = { state: AttachState.Detached };\n\tprivate readonly serializedStateManager: SerializedStateManager;\n\tprivate readonly _containerId: string;\n\n\tprivate lastVisible: number | undefined;\n\tprivate readonly visibilityEventHandler: (() => void) | undefined;\n\tprivate readonly connectionStateHandler: IConnectionStateHandler;\n\tprivate readonly clientsWhoShouldHaveLeft = new Set<string>();\n\tprivate _containerMetadata: Readonly<Record<string, string>> = {};\n\n\tprivate setAutoReconnectTime = performanceNow();\n\n\tprivate noopHeuristic: NoopHeuristic | undefined;\n\n\tprivate get connectionMode(): ConnectionMode {\n\t\treturn this._deltaManager.connectionManager.connectionMode;\n\t}\n\n\tpublic get resolvedUrl(): IResolvedUrl | undefined {\n\t\t/**\n\t\t * All attached containers will have a document service,\n\t\t * this is required, as attached containers are attached to\n\t\t * a service. Detached containers will neither have a document\n\t\t * service or a resolved url as they only exist locally.\n\t\t * in order to create a document service a resolved url must\n\t\t * first be obtained, this is how the container is identified.\n\t\t * Because of this, the document service's resolved url\n\t\t * is always the same as the containers, as we had to\n\t\t * obtain the resolved url, and then create the service from it.\n\t\t */\n\t\treturn this.service?.resolvedUrl;\n\t}\n\n\tpublic get readOnlyInfo(): ReadOnlyInfo {\n\t\treturn this._deltaManager.readOnlyInfo;\n\t}\n\n\tpublic get containerMetadata(): Record<string, string> {\n\t\treturn this._containerMetadata;\n\t}\n\n\t/**\n\t * Sends signal to runtime (and data stores) to be read-only.\n\t * Hosts may have read only views, indicating to data stores that no edits are allowed.\n\t * This is independent from this._readonlyPermissions (permissions) and this.connectionMode\n\t * (server can return \"write\" mode even when asked for \"read\")\n\t * Leveraging same \"readonly\" event as runtime & data stores should behave the same in such case\n\t * as in read-only permissions.\n\t * But this.active can be used by some DDSes to figure out if ops can be sent\n\t * (for example, read-only view still participates in code proposals / upgrades decisions)\n\t *\n\t * Forcing Readonly does not prevent DDS from generating ops. It is up to user code to honour\n\t * the readonly flag. If ops are generated, they will accumulate locally and not be sent. If\n\t * there are pending in the outbound queue, it will stop sending until force readonly is\n\t * cleared.\n\t *\n\t * @param readonly - set or clear force readonly.\n\t */\n\tpublic forceReadonly(readonly: boolean): void {\n\t\tthis._deltaManager.connectionManager.forceReadonly(readonly);\n\t}\n\n\tpublic get deltaManager(): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n\t\treturn this._deltaManager;\n\t}\n\n\tpublic get connectionState(): ConnectionState {\n\t\treturn this.connectionStateHandler.connectionState;\n\t}\n\n\tprivate get connected(): boolean {\n\t\treturn this.connectionStateHandler.connectionState === ConnectionState.Connected;\n\t}\n\n\t/**\n\t * clientId of the latest connection. Changes only once client is connected, caught up and fully loaded.\n\t * Changes to clientId are delayed through container loading sequence and delived once container is fully loaded.\n\t * clientId does not reset on lost connection - old value persists until new connection is fully established.\n\t */\n\tpublic get clientId(): string | undefined {\n\t\treturn this.protocolHandler.audience.getSelf()?.clientId;\n\t}\n\n\tprivate get isInteractiveClient(): boolean {\n\t\treturn this.deltaManager.clientDetails.capabilities.interactive;\n\t}\n\n\tprivate supportGetSnapshotApi(): boolean {\n\t\tconst supportGetSnapshotApi: boolean =\n\t\t\tthis.mc.config.getBoolean(\"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2\") ===\n\t\t\t\ttrue && this.service?.policies?.supportGetSnapshotApi === true;\n\t\treturn supportGetSnapshotApi;\n\t}\n\n\t/**\n\t * Get the code details that are currently specified for the container.\n\t * @returns The current code details if any are specified, undefined if none are specified.\n\t */\n\tpublic getSpecifiedCodeDetails(): IFluidCodeDetails | undefined {\n\t\treturn this.getCodeDetailsFromQuorum();\n\t}\n\n\tprivate _loadedCodeDetails: IFluidCodeDetails | undefined;\n\t/**\n\t * Get the code details that were used to load the container.\n\t * @returns The code details that were used to load the container if it is loaded, undefined if it is not yet\n\t * loaded.\n\t */\n\tpublic getLoadedCodeDetails(): IFluidCodeDetails | undefined {\n\t\treturn this._loadedCodeDetails;\n\t}\n\n\tprivate _loadedModule: IFluidModuleWithDetails | undefined;\n\n\t/**\n\t * Retrieves the audience associated with the document\n\t */\n\tpublic get audience(): IAudience {\n\t\treturn this.protocolHandler.audience;\n\t}\n\n\t/**\n\t * Returns true if container is dirty.\n\t * Which means data loss if container is closed at that same moment\n\t * Most likely that happens when there is no network connection to Relay Service\n\t */\n\tpublic get isDirty(): boolean {\n\t\treturn this._dirtyContainer;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/container-definitions#IContainer.entryPoint}\n\t */\n\tpublic async getEntryPoint(): Promise<FluidObject> {\n\t\tif (this._disposed) {\n\t\t\tthrow new UsageError(\"The context is already disposed\");\n\t\t}\n\t\tif (this._runtime !== undefined) {\n\t\t\treturn this._runtime.getEntryPoint?.();\n\t\t}\n\t\treturn new Promise<FluidObject>((resolve, reject) => {\n\t\t\tconst runtimeInstantiatedHandler = (): void => {\n\t\t\t\tassert(\n\t\t\t\t\tthis._runtime !== undefined,\n\t\t\t\t\t0x5a3 /* runtimeInstantiated fired but runtime is still undefined */,\n\t\t\t\t);\n\t\t\t\tresolve(this._runtime.getEntryPoint?.());\n\t\t\t\tthis._lifecycleEvents.off(\"disposed\", disposedHandler);\n\t\t\t};\n\t\t\tconst disposedHandler = (): void => {\n\t\t\t\treject(new Error(\"ContainerContext was disposed\"));\n\t\t\t\tthis._lifecycleEvents.off(\"runtimeInstantiated\", runtimeInstantiatedHandler);\n\t\t\t};\n\t\t\tthis._lifecycleEvents.once(\"runtimeInstantiated\", runtimeInstantiatedHandler);\n\t\t\tthis._lifecycleEvents.once(\"disposed\", disposedHandler);\n\t\t});\n\t}\n\n\tprivate readonly _lifecycleEvents = new TypedEventEmitter<IContainerLifecycleEvents>();\n\n\tconstructor(\n\t\tcreateProps: IContainerCreateProps,\n\t\tloadProps?: Pick<IContainerLoadProps, \"pendingLocalState\">,\n\t) {\n\t\tsuper((name, error) => {\n\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"ContainerEventHandlerException\",\n\t\t\t\t\tname: typeof name === \"string\" ? name : undefined,\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t\tthis.close(normalizeError(error));\n\t\t});\n\n\t\tconst {\n\t\t\tcanReconnect,\n\t\t\tclientDetailsOverride,\n\t\t\turlResolver,\n\t\t\tdocumentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\toptions,\n\t\t\tscope,\n\t\t\tsubLogger,\n\t\t\tprotocolHandlerBuilder,\n\t\t} = createProps;\n\n\t\t// Validate that the Driver is compatible with this Loader.\n\t\tconst maybeDriverCompatDetails =\n\t\t\tdocumentServiceFactory as FluidObject<ILayerCompatDetails>;\n\t\tvalidateDriverCompatibility(\n\t\t\tmaybeDriverCompatDetails.ILayerCompatDetails,\n\t\t\t(error) => {} /* disposeFn */, // There is nothing to dispose here, so just ignore the error.\n\t\t\tsubLogger,\n\t\t);\n\n\t\tthis.connectionTransitionTimes[ConnectionState.Disconnected] = performanceNow();\n\t\tconst pendingLocalState = loadProps?.pendingLocalState;\n\n\t\tthis._canReconnect = canReconnect ?? true;\n\t\tthis.clientDetailsOverride = clientDetailsOverride;\n\t\tthis.urlResolver = urlResolver;\n\t\tthis.serviceFactory = documentServiceFactory;\n\t\tthis.codeLoader = codeLoader;\n\t\t// Warning: this is only a shallow clone. Mutation of any individual loader option will mutate it for\n\t\t// all clients that were loaded from the same loader (including summarizer clients).\n\t\t// Tracking alternative ways to handle this in AB#4129.\n\t\tthis.options = { ...options };\n\t\tthis.scope = scope;\n\t\tthis.protocolHandlerBuilder = wrapProtocolHandlerBuilder(\n\t\t\tprotocolHandlerBuilder ??\n\t\t\t\t((\n\t\t\t\t\tattributes: IDocumentAttributes,\n\t\t\t\t\tquorumSnapshot: IQuorumSnapshot,\n\t\t\t\t\tsendProposal: (key: string, value: unknown) => number,\n\t\t\t\t): ProtocolHandlerInternal =>\n\t\t\t\t\tnew ProtocolHandler(\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t\tquorumSnapshot,\n\t\t\t\t\t\tsendProposal,\n\t\t\t\t\t\tnew Audience(),\n\t\t\t\t\t\t(clientId: string) => this.clientsWhoShouldHaveLeft.has(clientId),\n\t\t\t\t\t)),\n\t\t\tthis.signalAudience,\n\t\t);\n\n\t\t// Note that we capture the createProps here so we can replicate the creation call when we want to clone.\n\t\tthis.clone = async (\n\t\t\t_loadProps: IContainerLoadProps,\n\t\t\tcreateParamOverrides: Partial<IContainerCreateProps>,\n\t\t): Promise<Container> => {\n\t\t\treturn Container.load(_loadProps, {\n\t\t\t\t...createProps,\n\t\t\t\t...createParamOverrides,\n\t\t\t});\n\t\t};\n\n\t\tthis._containerId = uuid();\n\n\t\tthis.client = Container.setupClient(\n\t\t\tthis._containerId,\n\t\t\toptions.client,\n\t\t\tthis.clientDetailsOverride,\n\t\t);\n\n\t\t// Create logger for data stores to use\n\t\tconst type = this.client.details.type;\n\t\tconst interactive = this.client.details.capabilities.interactive;\n\t\tconst clientType = `${interactive ? \"interactive\" : \"noninteractive\"}${\n\t\t\ttype !== undefined && type !== \"\" ? `/${type}` : \"\"\n\t\t}`;\n\n\t\t// Need to use the property getter for docId because for detached flow we don't have the docId initially.\n\t\t// We assign the id later so property getter is used.\n\t\tthis.subLogger = createChildLogger({\n\t\t\tlogger: subLogger,\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\tclientType, // Differentiating summarizer container from main container\n\t\t\t\t\tcontainerId: this._containerId,\n\t\t\t\t\tdocId: () => this.resolvedUrl?.id,\n\t\t\t\t\tcontainerAttachState: () => this.attachState,\n\t\t\t\t\tcontainerLifecycleState: () => this._lifecycleState,\n\t\t\t\t\tcontainerConnectionState: () => ConnectionState[this.connectionState],\n\t\t\t\t\tserializedContainer: pendingLocalState !== undefined,\n\t\t\t\t},\n\t\t\t\t// we need to be judicious with our logging here to avoid generating too much data\n\t\t\t\t// all data logged here should be broadly applicable, and not specific to a\n\t\t\t\t// specific error or class of errors\n\t\t\t\terror: {\n\t\t\t\t\t// load information to associate errors with the specific load point\n\t\t\t\t\tdmInitialSeqNumber: () => this._deltaManager?.initialSequenceNumber,\n\t\t\t\t\tdmLastProcessedSeqNumber: () => this._deltaManager?.lastSequenceNumber,\n\t\t\t\t\tdmLastKnownSeqNumber: () => this._deltaManager?.lastKnownSeqNumber,\n\t\t\t\t\tcontainerLoadedFromVersionId: () => this._loadedFromVersion?.id,\n\t\t\t\t\tcontainerLoadedFromVersionDate: () => this._loadedFromVersion?.date,\n\t\t\t\t\t// message information to associate errors with the specific execution state\n\t\t\t\t\t// dmLastMsqSeqNumber: if present, same as dmLastProcessedSeqNumber\n\t\t\t\t\tdmLastMsqSeqNumber: () => this.deltaManager?.lastMessage?.sequenceNumber,\n\t\t\t\t\tdmLastMsqSeqTimestamp: () => this.deltaManager?.lastMessage?.timestamp,\n\t\t\t\t\tdmLastMsqSeqClientId: () =>\n\t\t\t\t\t\tthis.deltaManager?.lastMessage?.clientId === null\n\t\t\t\t\t\t\t? \"null\"\n\t\t\t\t\t\t\t: this.deltaManager?.lastMessage?.clientId,\n\t\t\t\t\tdmLastMsgClientSeq: () => this.deltaManager?.lastMessage?.clientSequenceNumber,\n\t\t\t\t\tconnectionStateDuration: () =>\n\t\t\t\t\t\tperformanceNow() - this.connectionTransitionTimes[this.connectionState],\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\t// Prefix all events in this file with container-loader\n\t\tthis.mc = createChildMonitoringContext({ logger: this.subLogger, namespace: \"Container\" });\n\n\t\tthis._deltaManager = this.createDeltaManager();\n\n\t\tthis.connectionStateHandler = createConnectionStateHandler(\n\t\t\t{\n\t\t\t\tlogger: this.mc.logger,\n\t\t\t\t// WARNING: logger on this context should not including getters like containerConnectionState above (on this.subLogger),\n\t\t\t\t// as that will result in attempt to dereference this.connectionStateHandler from this call while it's still undefined.\n\t\t\t\tmc: loggerToMonitoringContext(subLogger),\n\t\t\t\tconnectionStateChanged: (value, oldState, reason) => {\n\t\t\t\t\tthis.logConnectionStateChangeTelemetry(value, oldState, reason);\n\t\t\t\t\tif (this.loaded) {\n\t\t\t\t\t\tthis.propagateConnectionState(\n\t\t\t\t\t\t\tvalue === ConnectionState.Disconnected\n\t\t\t\t\t\t\t\t? reason\n\t\t\t\t\t\t\t\t: undefined /* disconnectedReason */,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tshouldClientJoinWrite: () => this._deltaManager.connectionManager.shouldJoinWrite(),\n\t\t\t\tmaxClientLeaveWaitTime: options.maxClientLeaveWaitTime,\n\t\t\t\tlogConnectionIssue: (\n\t\t\t\t\teventName: string,\n\t\t\t\t\tcategory: TelemetryEventCategory,\n\t\t\t\t\tdetails?: ITelemetryBaseProperties,\n\t\t\t\t) => {\n\t\t\t\t\tconst mode = this.connectionMode;\n\t\t\t\t\t// We get here when socket does not receive any ops on \"write\" connection, including\n\t\t\t\t\t// its own join op.\n\t\t\t\t\t// Report issues only if we already loaded container - op processing is paused while container is loading,\n\t\t\t\t\t// so we always time-out processing of join op in cases where fetching snapshot takes a minute.\n\t\t\t\t\t// It's not a problem with op processing itself - such issues should be tracked as part of boot perf monitoring instead.\n\t\t\t\t\tthis._deltaManager.logConnectionIssue({\n\t\t\t\t\t\teventName,\n\t\t\t\t\t\tmode,\n\t\t\t\t\t\tcategory: this._lifecycleState === \"loading\" ? \"generic\" : category,\n\t\t\t\t\t\tduration:\n\t\t\t\t\t\t\tperformanceNow() - this.connectionTransitionTimes[ConnectionState.CatchingUp],\n\t\t\t\t\t\t...(details === undefined ? {} : { details: JSON.stringify(details) }),\n\t\t\t\t\t});\n\n\t\t\t\t\t// This assert is important for many reasons:\n\t\t\t\t\t// 1) Cosmetic / OCE burden: It's useless to raise NoJoinOp error events, if we are loading, as that's most\n\t\t\t\t\t// likely to happen if snapshot loading takes too long. During this time we are not processing ops so there is no\n\t\t\t\t\t// way to move to \"connected\" state, and thus \"NoJoin\" timer would fire (see\n\t\t\t\t\t// IConnectionStateHandler.logConnectionIssue() callback and related code in ConnectStateHandler class implementation).\n\t\t\t\t\t// But these events do not tell us anything about connectivity pipeline / op processing pipeline,\n\t\t\t\t\t// only that boot is slow, and we have events for that.\n\t\t\t\t\t// 2) Doing recovery below is useless in loading mode, for the reasons described above. At the same time we can't\n\t\t\t\t\t// not do it, as maybe we lost JoinSignal for \"self\", and when loading is done, we never move to connected\n\t\t\t\t\t// state. So we would have to do (in most cases) useless infinite reconnect loop while we are loading.\n\t\t\t\t\tassert(\n\t\t\t\t\t\tthis.loaded,\n\t\t\t\t\t\t0x96b /* connection issues can be raised only after container is loaded */,\n\t\t\t\t\t);\n\n\t\t\t\t\t// If this is \"write\" connection, it took too long to receive join op. But in most cases that's due\n\t\t\t\t\t// to very slow op fetches and we will eventually get there.\n\t\t\t\t\t// For \"read\" connections, we get here due to join signal for \"self\" not arriving on time.\n\t\t\t\t\t// Attempt to recover by reconnecting.\n\t\t\t\t\tif (mode === \"read\" && category === \"error\") {\n\t\t\t\t\t\tconst reason = { text: \"NoJoinSignal\" };\n\t\t\t\t\t\tthis.disconnectInternal(reason);\n\t\t\t\t\t\tthis.connectInternal({ reason, fetchOpsFromStorage: false });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tclientShouldHaveLeft: (clientId: string) => {\n\t\t\t\t\tthis.clientsWhoShouldHaveLeft.add(clientId);\n\t\t\t\t},\n\t\t\t\tonCriticalError: (error: unknown) => {\n\t\t\t\t\tthis.close(normalizeError(error));\n\t\t\t\t},\n\t\t\t},\n\t\t\tthis.deltaManager,\n\t\t\tpendingLocalState?.clientId,\n\t\t);\n\n\t\tthis.on(savedContainerEvent, () => {\n\t\t\tthis.connectionStateHandler.containerSaved();\n\t\t});\n\n\t\t// We expose our storage publicly, so it's possible others may call uploadSummaryWithContext() with a\n\t\t// non-combined summary tree (in particular, ContainerRuntime.submitSummary). We'll intercept those calls\n\t\t// using this callback and fix them up.\n\t\tconst addProtocolSummaryIfMissing = (\n\t\t\tsummaryTree: ISummaryTree,\n\t\t): CombinedAppAndProtocolSummary =>\n\t\t\tisCombinedAppAndProtocolSummary(summaryTree) === true\n\t\t\t\t? summaryTree\n\t\t\t\t: combineAppAndProtocolSummary(summaryTree, this.captureProtocolSummary());\n\n\t\t// Feature gate to enable single-commit summaries. The expected enablement is through driver layer's policies,\n\t\t// but here we also specify config setting to use for testing purposes.\n\t\tconst enableSummarizeProtocolTree = this.mc.config.getBoolean(\n\t\t\t\"Fluid.Container.summarizeProtocolTree2\",\n\t\t);\n\n\t\tthis.detachedBlobStorage =\n\t\t\tthis.attachState === AttachState.Attached\n\t\t\t\t? undefined\n\t\t\t\t: createMemoryDetachedBlobStorage();\n\n\t\tthis.storageAdapter = new ContainerStorageAdapter(\n\t\t\tthis.detachedBlobStorage,\n\t\t\tthis.mc.logger,\n\t\t\tpendingLocalState?.loadedGroupIdSnapshots,\n\t\t\taddProtocolSummaryIfMissing,\n\t\t\tenableSummarizeProtocolTree,\n\t\t);\n\n\t\tconst offlineLoadEnabled =\n\t\t\tthis.isInteractiveClient &&\n\t\t\t(this.mc.config.getBoolean(\"Fluid.Container.enableOfflineLoad\") ??\n\t\t\t\tthis.mc.config.getBoolean(\"Fluid.Container.enableOfflineFull\") ??\n\t\t\t\toptions.enableOfflineLoad !== false);\n\t\tthis.serializedStateManager = new SerializedStateManager(\n\t\t\tthis.subLogger,\n\t\t\tthis.storageAdapter,\n\t\t\tofflineLoadEnabled,\n\t\t\tthis,\n\t\t\t() => this._deltaManager.connectionManager.shouldJoinWrite(),\n\t\t\t() => this.supportGetSnapshotApi(),\n\t\t\tthis.mc.config.getNumber(\"Fluid.Container.snapshotRefreshTimeoutMs\"),\n\t\t);\n\n\t\tconst isDomAvailable =\n\t\t\ttypeof document === \"object\" &&\n\t\t\tdocument !== null &&\n\t\t\ttypeof document.addEventListener === \"function\" &&\n\t\t\tdocument.addEventListener !== null;\n\t\t// keep track of last time page was visible for telemetry (on interactive clients only)\n\t\tif (isDomAvailable && interactive) {\n\t\t\tthis.lastVisible = document.hidden ? performanceNow() : undefined;\n\t\t\tthis.visibilityEventHandler = (): void => {\n\t\t\t\tif (document.hidden) {\n\t\t\t\t\tthis.lastVisible = performanceNow();\n\t\t\t\t} else {\n\t\t\t\t\t// settimeout so this will hopefully fire after disconnect event if being hidden caused it\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tthis.lastVisible = undefined;\n\t\t\t\t\t}, 0);\n\t\t\t\t}\n\t\t\t};\n\t\t\tdocument.addEventListener(\"visibilitychange\", this.visibilityEventHandler);\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the quorum associated with the document\n\t */\n\tpublic getQuorum(): IQuorumClients {\n\t\treturn this.protocolHandler.quorum;\n\t}\n\n\tpublic dispose(error?: ICriticalContainerError): void {\n\t\tthis.verifyClosedAfter(() => this._deltaManager.dispose(error));\n\t}\n\n\tpublic close(error?: ICriticalContainerError): void {\n\t\t// 1. Ensure that close sequence is exactly the same no matter if it's initiated by host or by DeltaManager\n\t\t// 2. We need to ensure that we deliver disconnect event to runtime properly. See connectionStateChanged\n\t\t// handler. We only deliver events if container fully loaded. Transitioning from \"loading\" ->\n\t\t// \"closing\" will lose that info (can also solve by tracking extra state).\n\t\tthis.verifyClosedAfter(() => this._deltaManager.close(error));\n\t}\n\n\tprivate verifyClosedAfterCalls = 0;\n\tprivate verifyClosedAfter(callback: () => void): void {\n\t\tthis.verifyClosedAfterCalls++;\n\t\ttry {\n\t\t\tcallback();\n\t\t} finally {\n\t\t\tthis.verifyClosedAfterCalls--;\n\t\t}\n\n\t\t// We only want to verify connectionState and lifecycleState after close/dispose has fully finished\n\t\tif (this.verifyClosedAfterCalls === 0) {\n\t\t\tassert(\n\t\t\t\tthis.connectionState === ConnectionState.Disconnected,\n\t\t\t\t0x0cf /* \"disconnect event was not raised!\" */,\n\t\t\t);\n\n\t\t\tassert(\n\t\t\t\tthis._lifecycleState === \"closed\" || this._lifecycleState === \"disposed\",\n\t\t\t\t0x314 /* Container properly closed */,\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate closeCore(error?: ICriticalContainerError): void {\n\t\tassert(!this.closed, 0x315 /* re-entrancy */);\n\n\t\ttry {\n\t\t\t// Ensure that we raise all key events even if one of these throws\n\t\t\ttry {\n\t\t\t\t// Raise event first, to ensure we capture _lifecycleState before transition.\n\t\t\t\t// This gives us a chance to know what errors happened on open vs. on fully loaded container.\n\t\t\t\t// Log generic events instead of error events if container is in loading state, as most errors are not really FF errors\n\t\t\t\t// which can pollute telemetry for real bugs\n\t\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"ContainerClose\",\n\t\t\t\t\t\tcategory:\n\t\t\t\t\t\t\tthis._lifecycleState !== \"loading\" && error !== undefined ? \"error\" : \"generic\",\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\tthis._lifecycleState = \"closing\";\n\n\t\t\t\t// Back-compat for Old driver\n\t\t\t\tif (this.service?.off !== undefined) {\n\t\t\t\t\tthis.service?.off(\"metadataUpdate\", this.metadataUpdateHandler);\n\t\t\t\t}\n\n\t\t\t\tthis._protocolHandler?.close();\n\n\t\t\t\tthis.connectionStateHandler.dispose();\n\t\t\t\tthis.serializedStateManager.dispose();\n\t\t\t} catch (newError) {\n\t\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"ContainerCloseException\" }, newError);\n\t\t\t}\n\n\t\t\tthis.emit(\"closed\", error);\n\n\t\t\tif (this.visibilityEventHandler !== undefined) {\n\t\t\t\tdocument.removeEventListener(\"visibilitychange\", this.visibilityEventHandler);\n\t\t\t}\n\t\t} finally {\n\t\t\tthis._lifecycleState = \"closed\";\n\n\t\t\t// There is no user for summarizer, so we need to ensure dispose is called\n\t\t\tif (this.client.details.type === summarizerClientType) {\n\t\t\t\tthis.dispose(error);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _disposed = false;\n\tprivate disposeCore(error?: ICriticalContainerError): void {\n\t\tassert(!this._disposed, 0x54c /* Container already disposed */);\n\t\tthis._disposed = true;\n\n\t\ttry {\n\t\t\t// Ensure that we raise all key events even if one of these throws\n\t\t\ttry {\n\t\t\t\t// Raise event first, to ensure we capture _lifecycleState before transition.\n\t\t\t\t// This gives us a chance to know what errors happened on open vs. on fully loaded container.\n\t\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"ContainerDispose\",\n\t\t\t\t\t\t// Only log error if container isn't closed\n\t\t\t\t\t\tcategory: !this.closed && error !== undefined ? \"error\" : \"generic\",\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\t// ! Progressing from \"closed\" to \"disposing\" is not allowed\n\t\t\t\tif (this._lifecycleState !== \"closed\") {\n\t\t\t\t\tthis._lifecycleState = \"disposing\";\n\t\t\t\t}\n\n\t\t\t\tthis._protocolHandler?.close();\n\n\t\t\t\tthis.connectionStateHandler.dispose();\n\t\t\t\tthis.serializedStateManager.dispose();\n\n\t\t\t\tconst maybeError = error === undefined ? undefined : new Error(error.message);\n\t\t\t\tthis._runtime?.dispose(maybeError);\n\n\t\t\t\tthis.storageAdapter.dispose();\n\n\t\t\t\t// Notify storage about critical errors. They may be due to disconnect between client & server knowledge\n\t\t\t\t// about file, like file being overwritten in storage, but client having stale local cache.\n\t\t\t\t// Driver need to ensure all caches are cleared on critical errors\n\t\t\t\tthis.service?.dispose(error);\n\t\t\t} catch (error_) {\n\t\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"ContainerDisposeException\" }, error_);\n\t\t\t}\n\n\t\t\tthis.emit(\"disposed\", error);\n\n\t\t\tthis.removeAllListeners();\n\t\t\tif (this.visibilityEventHandler !== undefined) {\n\t\t\t\tdocument.removeEventListener(\"visibilitychange\", this.visibilityEventHandler);\n\t\t\t}\n\t\t} finally {\n\t\t\tthis._lifecycleState = \"disposed\";\n\t\t\tthis._lifecycleEvents.emit(\"disposed\");\n\t\t}\n\t}\n\n\t/**\n\t * Serialize current container state required to rehydrate to the same position without dataloss.\n\t * Note: The container must already be attached. For detached containers use {@link serialize}\n\t * @returns stringified {@link IPendingContainerState} for the container\n\t */\n\tpublic async getPendingLocalState(): Promise<string> {\n\t\tif (this.closed || this._disposed) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Pending state cannot be retried if the container is closed or disposed\",\n\t\t\t);\n\t\t}\n\t\tassert(\n\t\t\tthis.attachmentData.state === AttachState.Attached,\n\t\t\t0x0d1 /* \"Container should be attached before close\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.resolvedUrl !== undefined && this.resolvedUrl.type === \"fluid\",\n\t\t\t0x0d2 /* \"resolved url should be valid Fluid url\" */,\n\t\t);\n\t\tconst pendingState = await this.serializedStateManager.getPendingLocalState(\n\t\t\tthis.clientId,\n\t\t\tthis.runtime,\n\t\t\tthis.resolvedUrl,\n\t\t);\n\t\treturn pendingState;\n\t}\n\n\tpublic get attachState(): AttachState {\n\t\treturn this.attachmentData.state;\n\t}\n\n\t/**\n\t * Serialize current container state required to rehydrate to the same position without dataloss.\n\t * Note: The container must be detached and not closed. For attached containers use\n\t * {@link getPendingLocalState}\n\t * @returns stringified {@link IPendingDetachedContainerState} for the container\n\t */\n\tpublic serialize(): string {\n\t\tif (this.attachmentData.state === AttachState.Attached || this.closed) {\n\t\t\tthrow new UsageError(\"Container must not be attached or closed.\");\n\t\t}\n\n\t\tconst attachingData =\n\t\t\tthis.attachmentData.state === AttachState.Attaching ? this.attachmentData : undefined;\n\n\t\tconst combinedSummary =\n\t\t\tattachingData?.summary ??\n\t\t\tcombineAppAndProtocolSummary(\n\t\t\t\tthis.runtime.createSummary(),\n\t\t\t\tthis.captureProtocolSummary(),\n\t\t\t);\n\n\t\tconst snapshot = getISnapshotFromSerializedContainer(combinedSummary);\n\t\tconst pendingRuntimeState =\n\t\t\tattachingData === undefined ? undefined : this.runtime.getPendingLocalState();\n\t\tassert(!isPromiseLike(pendingRuntimeState), 0x8e3 /* should not be a promise */);\n\n\t\tconst detachedContainerState: IPendingDetachedContainerState = {\n\t\t\tattached: false,\n\t\t\t...convertISnapshotToSnapshotWithBlobs(snapshot),\n\t\t\tpendingRuntimeState,\n\t\t\thasAttachmentBlobs:\n\t\t\t\tthis.detachedBlobStorage !== undefined && this.detachedBlobStorage.size > 0,\n\t\t\tattachmentBlobs: this.detachedBlobStorage?.serialize(),\n\t\t};\n\t\treturn JSON.stringify(detachedContainerState);\n\t}\n\n\tpublic readonly attach = runSingle(\n\t\tasync (\n\t\t\trequest: IRequest,\n\t\t\tattachProps?: { deltaConnection?: \"none\" | \"delayed\" },\n\t\t): Promise<void> => {\n\t\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.mc.logger,\n\t\t\t\t{ eventName: \"Attach\" },\n\t\t\t\tasync () => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis._lifecycleState !== \"loaded\" ||\n\t\t\t\t\t\tthis.attachmentData.state === AttachState.Attached\n\t\t\t\t\t) {\n\t\t\t\t\t\t// pre-0.58 error message: containerNotValidForAttach\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`The Container is not in a valid state for attach [${this._lifecycleState}] and [${this.attachState}]`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst normalizeErrorAndClose = (error: unknown): IFluidErrorBase => {\n\t\t\t\t\t\tconst newError = normalizeError(error);\n\t\t\t\t\t\tthis.close(newError);\n\t\t\t\t\t\t// add resolved URL on error object so that host has the ability to find this document and delete it\n\t\t\t\t\t\tnewError.addTelemetryProperties({\n\t\t\t\t\t\t\tresolvedUrl: this.service?.resolvedUrl?.url,\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn newError;\n\t\t\t\t\t};\n\n\t\t\t\t\tconst setAttachmentData: AttachProcessProps[\"setAttachmentData\"] = (\n\t\t\t\t\t\tattachmentData,\n\t\t\t\t\t) => {\n\t\t\t\t\t\tconst previousState = this.attachmentData.state;\n\t\t\t\t\t\tthis.attachmentData = attachmentData;\n\t\t\t\t\t\tconst state = this.attachmentData.state;\n\t\t\t\t\t\tif (state !== previousState && state !== AttachState.Detached) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tthis.runtime.setAttachState(state);\n\t\t\t\t\t\t\t\tthis.emit(state.toLocaleLowerCase());\n\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\tthrow normalizeErrorAndClose(error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tconst createAttachmentSummary: AttachProcessProps[\"createAttachmentSummary\"] = (\n\t\t\t\t\t\tredirectTable?: Map<string, string>,\n\t\t\t\t\t) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tthis._deltaManager.inbound.length === 0,\n\t\t\t\t\t\t\t\t0x0d6 /* \"Inbound queue should be empty when attaching\" */,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn combineAppAndProtocolSummary(\n\t\t\t\t\t\t\t\tthis.runtime.createSummary(redirectTable),\n\t\t\t\t\t\t\t\tthis.captureProtocolSummary(),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tthrow normalizeErrorAndClose(error);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tconst createOrGetStorageService: AttachProcessProps[\"createOrGetStorageService\"] =\n\t\t\t\t\t\tasync (summary) => {\n\t\t\t\t\t\t\t// Actually go and create the resolved document\n\t\t\t\t\t\t\tif (this.service === undefined) {\n\t\t\t\t\t\t\t\tconst createNewResolvedUrl = await this.urlResolver.resolve(request);\n\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\tthis.client.details.type !== summarizerClientType &&\n\t\t\t\t\t\t\t\t\t\tcreateNewResolvedUrl !== undefined,\n\t\t\t\t\t\t\t\t\t0x2c4 /* \"client should not be summarizer before container is created\" */,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tthis.service = await this.createDocumentService(createNewResolvedUrl, {\n\t\t\t\t\t\t\t\t\tmode: \"attach\",\n\t\t\t\t\t\t\t\t\tsummary,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis.storageAdapter.connectToService(this.service);\n\t\t\t\t\t\t\treturn this.storageAdapter;\n\t\t\t\t\t\t};\n\n\t\t\t\t\tlet attachP = runRetriableAttachProcess({\n\t\t\t\t\t\tinitialAttachmentData: this.attachmentData,\n\t\t\t\t\t\tdetachedBlobStorage: this.detachedBlobStorage,\n\t\t\t\t\t\tsetAttachmentData,\n\t\t\t\t\t\tcreateAttachmentSummary,\n\t\t\t\t\t\tcreateOrGetStorageService,\n\t\t\t\t\t});\n\n\t\t\t\t\t// only enable the new behavior if the config is set\n\t\t\t\t\tif (this.mc.config.getBoolean(\"Fluid.Container.RetryOnAttachFailure\") !== true) {\n\t\t\t\t\t\tattachP = attachP.catch((error) => {\n\t\t\t\t\t\t\tthrow normalizeErrorAndClose(error);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// If offline load is enabled, attachP will return the attach summary (in Snapshot format) so we can initialize SerializedStateManager\n\t\t\t\t\tconst snapshotWithBlobs = await attachP;\n\t\t\t\t\tthis.serializedStateManager.setInitialSnapshot(snapshotWithBlobs);\n\t\t\t\t\tif (!this.closed) {\n\t\t\t\t\t\tthis.detachedBlobStorage?.dispose?.();\n\t\t\t\t\t\tthis.handleDeltaConnectionArg(attachProps?.deltaConnection, {\n\t\t\t\t\t\t\tfetchOpsFromStorage: false,\n\t\t\t\t\t\t\treason: { text: \"createDetached\" },\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{ start: true, end: true, cancel: \"generic\" },\n\t\t\t);\n\t\t},\n\t);\n\n\tprivate setAutoReconnectInternal(\n\t\tmode: ReconnectMode,\n\t\treason: IConnectionStateChangeReason,\n\t): void {\n\t\tconst currentMode = this._deltaManager.connectionManager.reconnectMode;\n\n\t\tif (currentMode === mode) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst now = performanceNow();\n\t\tconst duration = now - this.setAutoReconnectTime;\n\t\tthis.setAutoReconnectTime = now;\n\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName:\n\t\t\t\tmode === ReconnectMode.Enabled ? \"AutoReconnectEnabled\" : \"AutoReconnectDisabled\",\n\t\t\tconnectionMode: this.connectionMode,\n\t\t\tconnectionState: ConnectionState[this.connectionState],\n\t\t\tduration,\n\t\t});\n\n\t\tthis._deltaManager.connectionManager.setAutoReconnect(mode, reason);\n\t}\n\n\tpublic connect(): void {\n\t\tif (this.closed) {\n\t\t\tthrow new UsageError(`The Container is closed and cannot be connected`);\n\t\t} else if (this.attachState !== AttachState.Attached) {\n\t\t\tthrow new UsageError(`The Container is not attached and cannot be connected`);\n\t\t} else if (!this.connected) {\n\t\t\t// Note: no need to fetch ops as we do it preemptively as part of DeltaManager.attachOpHandler().\n\t\t\t// If there is gap, we will learn about it once connected, but the gap should be small (if any),\n\t\t\t// assuming that connect() is called quickly after initial container boot.\n\t\t\tthis.connectInternal({\n\t\t\t\treason: { text: \"DocumentConnect\" },\n\t\t\t\tfetchOpsFromStorage: false,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate connectInternal(args: IConnectionArgs): void {\n\t\tassert(!this.closed, 0x2c5 /* \"Attempting to connect() a closed Container\" */);\n\t\tassert(\n\t\t\tthis.attachState === AttachState.Attached,\n\t\t\t0x2c6 /* \"Attempting to connect() a container that is not attached\" */,\n\t\t);\n\n\t\t// Set Auto Reconnect Mode\n\t\tconst mode = ReconnectMode.Enabled;\n\t\tthis.setAutoReconnectInternal(mode, args.reason);\n\n\t\t// Resume processing ops and connect to delta stream\n\t\tthis.resumeInternal(args);\n\t}\n\n\tpublic disconnect(): void {\n\t\tif (this.closed) {\n\t\t\tthrow new UsageError(`The Container is closed and cannot be disconnected`);\n\t\t} else {\n\t\t\tthis.disconnectInternal({ text: \"DocumentDisconnect\" });\n\t\t}\n\t}\n\n\tprivate disconnectInternal(reason: IConnectionStateChangeReason): void {\n\t\tassert(!this.closed, 0x2c7 /* \"Attempting to disconnect() a closed Container\" */);\n\n\t\t// Set Auto Reconnect Mode\n\t\tconst mode = ReconnectMode.Disabled;\n\t\tthis.setAutoReconnectInternal(mode, reason);\n\t}\n\n\tprivate resumeInternal(args: IConnectionArgs): void {\n\t\tassert(!this.closed, 0x0d9 /* \"Attempting to connect() a closed DeltaManager\" */);\n\n\t\t// Resume processing ops\n\t\tif (this.inboundQueuePausedFromInit) {\n\t\t\t// This assert guards against possibility of ops/signals showing up too soon, while\n\t\t\t// container is not ready yet to receive them. We can hit it only if some internal code call into here,\n\t\t\t// as public API like Container.connect() can be only called when user got back container object, i.e.\n\t\t\t// it is already fully loaded.\n\t\t\tassert(this.loaded, 0x96c /* connect() can be called only in fully loaded state */);\n\n\t\t\tthis.inboundQueuePausedFromInit = false;\n\t\t\tthis._deltaManager.inbound.resume();\n\t\t\tthis._deltaManager.inboundSignal.resume();\n\t\t}\n\n\t\t// Ensure connection to web socket\n\t\tthis.connectToDeltaStream(args);\n\t}\n\n\tpublic readonly getAbsoluteUrl = async (\n\t\trelativeUrl: string,\n\t): Promise<string | undefined> => {\n\t\tif (this.resolvedUrl === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn this.urlResolver.getAbsoluteUrl(\n\t\t\tthis.resolvedUrl,\n\t\t\trelativeUrl,\n\t\t\tgetPackageName(this._loadedCodeDetails),\n\t\t);\n\t};\n\n\tpublic async proposeCodeDetails(codeDetails: IFluidCodeDetails): Promise<boolean> {\n\t\tif (!isFluidCodeDetails(codeDetails)) {\n\t\t\tthrow new Error(\"Provided codeDetails are not IFluidCodeDetails\");\n\t\t}\n\n\t\tif (this.codeLoader.IFluidCodeDetailsComparer) {\n\t\t\tconst comparison = await this.codeLoader.IFluidCodeDetailsComparer.compare(\n\t\t\t\tcodeDetails,\n\t\t\t\tthis.getCodeDetailsFromQuorum(),\n\t\t\t);\n\t\t\tif (comparison !== undefined && comparison <= 0) {\n\t\t\t\tthrow new Error(\"Proposed code details should be greater than the current\");\n\t\t\t}\n\t\t}\n\n\t\treturn this.protocolHandler.quorum\n\t\t\t.propose(\"code\", codeDetails)\n\t\t\t.then(() => true)\n\t\t\t.catch(() => false);\n\t}\n\n\tprivate async processCodeProposal(): Promise<void> {\n\t\tconst codeDetails = this.getCodeDetailsFromQuorum();\n\n\t\tawait Promise.all([\n\t\t\tthis._deltaManager.inbound.pause(),\n\t\t\tthis._deltaManager.inboundSignal.pause(),\n\t\t]);\n\n\t\tif ((await this.satisfies(codeDetails)) === true) {\n\t\t\tthis._deltaManager.inbound.resume();\n\t\t\tthis._deltaManager.inboundSignal.resume();\n\t\t\treturn;\n\t\t}\n\n\t\t// pre-0.58 error message: existingContextDoesNotSatisfyIncomingProposal\n\t\tconst error = new GenericError(\"Existing context does not satisfy incoming proposal\");\n\t\tthis.close(error);\n\t}\n\n\t/**\n\t * Determines if the currently loaded module satisfies the incoming constraint code details\n\t */\n\tprivate async satisfies(constraintCodeDetails: IFluidCodeDetails): Promise<boolean> {\n\t\t// If we have no module, it can't satisfy anything.\n\t\tif (this._loadedModule === undefined) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst comparers: IFluidCodeDetailsComparer[] = [];\n\n\t\tconst maybeCompareCodeLoader = this.codeLoader;\n\t\tif (maybeCompareCodeLoader.IFluidCodeDetailsComparer !== undefined) {\n\t\t\tcomparers.push(maybeCompareCodeLoader.IFluidCodeDetailsComparer);\n\t\t}\n\n\t\tconst maybeCompareExport: Partial<IProvideFluidCodeDetailsComparer> | undefined =\n\t\t\tthis._loadedModule?.module.fluidExport;\n\t\tif (maybeCompareExport?.IFluidCodeDetailsComparer !== undefined) {\n\t\t\tcomparers.push(maybeCompareExport.IFluidCodeDetailsComparer);\n\t\t}\n\n\t\t// If there are no comparers, then it's impossible to know if the currently loaded package satisfies\n\t\t// the incoming constraint, so we return false. Assuming it does not satisfy is safer, to force a reload\n\t\t// rather than potentially running with incompatible code.\n\t\tif (comparers.length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (const comparer of comparers) {\n\t\t\tconst satisfies = await comparer.satisfies(\n\t\t\t\tthis._loadedModule?.details,\n\t\t\t\tconstraintCodeDetails,\n\t\t\t);\n\t\t\tif (satisfies === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate connectToDeltaStream(args: IConnectionArgs): void {\n\t\t// All agents need \"write\" access, including summarizer.\n\t\tif (!this._canReconnect || !this.client.details.capabilities.interactive) {\n\t\t\targs.mode = \"write\";\n\t\t}\n\n\t\tthis._deltaManager.connect(args);\n\t}\n\n\tprivate readonly metadataUpdateHandler = (metadata: Record<string, string>): void => {\n\t\tthis._containerMetadata = { ...this._containerMetadata, ...metadata };\n\t\tthis.emit(\"metadataUpdate\", metadata);\n\t};\n\n\t/**\n\t * Creates a document service during container attachment or loading.\n\t * @param resolvedUrl - The resolved URL of the container.\n\t * @param props - Properties indicating whether to load or attach the container. For attaching,\n\t * a summary tree can be provided.\n\t * @remarks This method validates that the driver is compatible with the Loader.\n\t */\n\tprivate async createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tprops: { mode: \"load\" } | { mode: \"attach\"; summary: ISummaryTree | undefined },\n\t): Promise<IDocumentService> {\n\t\tlet service: IDocumentService;\n\t\tif (props.mode === \"load\") {\n\t\t\tservice = await this.serviceFactory.createDocumentService(\n\t\t\t\tresolvedUrl,\n\t\t\t\tthis.subLogger,\n\t\t\t\tthis.client.details.type === summarizerClientType,\n\t\t\t);\n\t\t\tif (service.on !== undefined) {\n\t\t\t\t// Back-compat for Old driver\n\t\t\t\tservice.on(\"metadataUpdate\", this.metadataUpdateHandler);\n\t\t\t}\n\t\t} else {\n\t\t\tservice = await runWithRetry(\n\t\t\t\tasync () =>\n\t\t\t\t\tthis.serviceFactory.createContainer(\n\t\t\t\t\t\tprops.summary,\n\t\t\t\t\t\tresolvedUrl,\n\t\t\t\t\t\tthis.subLogger,\n\t\t\t\t\t\tfalse, // clientIsSummarizer\n\t\t\t\t\t),\n\t\t\t\t\"containerAttach\",\n\t\t\t\tthis.mc.logger,\n\t\t\t\t{\n\t\t\t\t\tcancel: this._deltaManager.closeAbortController.signal,\n\t\t\t\t}, // progress\n\t\t\t);\n\t\t}\n\t\treturn service;\n\t}\n\n\t/**\n\t * Load container.\n\t *\n\t * @param specifiedVersion - Version SHA to load snapshot. If not specified, will fetch the latest snapshot.\n\t */\n\tprivate async load(\n\t\tspecifiedVersion: string | undefined,\n\t\tloadMode: IContainerLoadMode,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tpendingLocalState: IPendingContainerState | undefined,\n\t): Promise<{\n\t\tsequenceNumber: number;\n\t\tversion: string | undefined;\n\t\tdmLastProcessedSeqNumber: number;\n\t\tdmLastKnownSeqNumber: number;\n\t}> {\n\t\tconst timings: Record<string, number> = { phase1: performanceNow() };\n\t\tthis.service = await this.createDocumentService(resolvedUrl, { mode: \"load\" });\n\n\t\t// Except in cases where its requested by feature gate, the container will connect in \"read\" mode\n\t\tconst mode =\n\t\t\tthis.mc.config.getBoolean(\"Fluid.Container.ForceWriteConnection\") === true\n\t\t\t\t? \"write\"\n\t\t\t\t: \"read\";\n\t\tconst connectionArgs: IConnectionArgs = {\n\t\t\treason: { text: \"DocumentOpen\" },\n\t\t\tmode,\n\t\t\tfetchOpsFromStorage: false,\n\t\t};\n\n\t\t// Start websocket connection as soon as possible. Note that there is no op handler attached yet, but the\n\t\t// DeltaManager is resilient to this and will wait to start processing ops until after it is attached.\n\t\tif (loadMode.deltaConnection === undefined) {\n\t\t\tthis.connectToDeltaStream(connectionArgs);\n\t\t}\n\n\t\tthis.storageAdapter.connectToService(this.service);\n\n\t\tthis.attachmentData = {\n\t\t\tstate: AttachState.Attached,\n\t\t};\n\n\t\ttimings.phase2 = performanceNow();\n\n\t\t// Fetch specified snapshot.\n\t\tconst {\n\t\t\tsnapshot: baseSnapshot,\n\t\t\tversion,\n\t\t\tattributes,\n\t\t} = await this.serializedStateManager.fetchSnapshot(specifiedVersion, pendingLocalState);\n\t\tconst baseSnapshotTree: ISnapshotTree | undefined = getSnapshotTree(baseSnapshot);\n\t\tthis._loadedFromVersion = version;\n\n\t\t// If we saved ops, we will replay them and don't need DeltaManager to fetch them\n\t\tconst lastProcessedSequenceNumber =\n\t\t\tpendingLocalState?.savedOps[pendingLocalState.savedOps.length - 1]?.sequenceNumber ??\n\t\t\tattributes.sequenceNumber;\n\t\tlet opsBeforeReturnP: Promise<void> | undefined;\n\n\t\t// Attach op handlers to finish initialization and be able to start processing ops\n\t\t// Kick off any ops fetching if required.\n\t\tswitch (loadMode.opsBeforeReturn) {\n\t\t\tcase undefined: {\n\t\t\t\t// Start prefetch, but not set opsBeforeReturnP - boot is not blocked by it!\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\t\tthis.attachDeltaManagerOpHandler(\n\t\t\t\t\tattributes,\n\t\t\t\t\tloadMode.deltaConnection === \"none\" ? \"none\" : \"all\",\n\t\t\t\t\tlastProcessedSequenceNumber,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"cached\":\n\t\t\tcase \"all\": {\n\t\t\t\topsBeforeReturnP = this.attachDeltaManagerOpHandler(\n\t\t\t\t\tattributes,\n\t\t\t\t\tloadMode.opsBeforeReturn,\n\t\t\t\t\tlastProcessedSequenceNumber,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(loadMode.opsBeforeReturn);\n\t\t\t}\n\t\t}\n\n\t\t// ...load in the existing quorum\n\t\t// Initialize the protocol handler\n\t\tawait this.initializeProtocolStateFromSnapshot(\n\t\t\tattributes,\n\t\t\tthis.storageAdapter,\n\t\t\tbaseSnapshotTree,\n\t\t);\n\n\t\t// If we are loading from pending state, we start with old clientId.\n\t\t// We switch to latest connection clientId only after setLoaded().\n\t\tassert(this.clientId === undefined, 0x96d /* there should be no clientId yet */);\n\t\tif (pendingLocalState?.clientId !== undefined) {\n\t\t\tthis.protocolHandler.audience.setCurrentClientId(pendingLocalState?.clientId);\n\t\t}\n\n\t\ttimings.phase3 = performanceNow();\n\t\tconst codeDetails = this.getCodeDetailsFromQuorum();\n\t\tawait this.instantiateRuntime(\n\t\t\tcodeDetails,\n\t\t\tbaseSnapshotTree,\n\t\t\t// give runtime a dummy value so it knows we're loading from a stash blob\n\t\t\tpendingLocalState ? (pendingLocalState?.pendingRuntimeState ?? {}) : undefined,\n\t\t\tisInstanceOfISnapshot(baseSnapshot) ? baseSnapshot : undefined,\n\t\t);\n\n\t\t// replay saved ops\n\t\tif (pendingLocalState) {\n\t\t\tfor (const message of pendingLocalState.savedOps) {\n\t\t\t\tthis.processRemoteMessage({\n\t\t\t\t\t...message,\n\t\t\t\t\tmetadata: { ...(message.metadata as Record<string, unknown>), savedOp: true },\n\t\t\t\t});\n\n\t\t\t\t// allow runtime to apply stashed ops at this op's sequence number\n\t\t\t\tawait this.runtime.notifyOpReplay?.(message);\n\t\t\t}\n\t\t\tpendingLocalState.savedOps = [];\n\t\t\tthis.storageAdapter.clearPendingState();\n\t\t}\n\n\t\t// We might have hit some failure that did not manifest itself in exception in this flow,\n\t\t// do not start op processing in such case - static version of Container.load() will handle it correctly.\n\t\tif (!this.closed) {\n\t\t\tif (opsBeforeReturnP !== undefined) {\n\t\t\t\tthis._deltaManager.inbound.resume();\n\n\t\t\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\t\t\tthis.mc.logger,\n\t\t\t\t\t{ eventName: \"WaitOps\" },\n\t\t\t\t\tasync () => opsBeforeReturnP,\n\t\t\t\t);\n\t\t\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\t\t\tthis.mc.logger,\n\t\t\t\t\t{ eventName: \"WaitOpProcessing\" },\n\t\t\t\t\tasync () => this._deltaManager.inbound.waitTillProcessingDone(),\n\t\t\t\t);\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\t\tthis._deltaManager.inbound.pause();\n\t\t\t}\n\n\t\t\t// Internal context is fully loaded at this point\n\t\t\t// Move to loaded before calling this.handleDeltaConnectionArg() - latter allows ops & signals in, which\n\t\t\t// may result in container moving to \"connected\" state. Such transitions are allowed only in loaded state.\n\t\t\tthis.setLoaded();\n\n\t\t\tthis.handleDeltaConnectionArg(loadMode.deltaConnection);\n\t\t}\n\n\t\t// Safety net: static version of Container.load() should have learned about it through \"closed\" handler.\n\t\t// But if that did not happen for some reason, fail load for sure.\n\t\t// Otherwise we can get into situations where container is closed and does not try to connect to ordering\n\t\t// service, but caller does not know that (callers do expect container to be not closed on successful path\n\t\t// and listen only on \"closed\" event)\n\t\tif (this.closed) {\n\t\t\tthrow new Error(\"Container was closed while load()\");\n\t\t}\n\n\t\ttimings.end = performanceNow();\n\t\tthis.subLogger.sendTelemetryEvent(\n\t\t\t{\n\t\t\t\teventName: \"LoadStagesTimings\",\n\t\t\t\tdetails: JSON.stringify(timings),\n\t\t\t},\n\t\t\tundefined,\n\t\t\tLogLevel.verbose,\n\t\t);\n\t\treturn {\n\t\t\tsequenceNumber: attributes.sequenceNumber,\n\t\t\tversion: version?.id,\n\t\t\tdmLastProcessedSeqNumber: this._deltaManager.lastSequenceNumber,\n\t\t\tdmLastKnownSeqNumber: this._deltaManager.lastKnownSeqNumber,\n\t\t};\n\t}\n\n\tprivate async createDetached(codeDetails: IFluidCodeDetails): Promise<void> {\n\t\tconst attributes: IDocumentAttributes = {\n\t\t\tsequenceNumber: detachedContainerRefSeqNumber,\n\t\t\tminimumSequenceNumber: 0,\n\t\t};\n\n\t\tawait this.attachDeltaManagerOpHandler(attributes);\n\n\t\t// Need to just seed the source data in the code quorum. Quorum itself is empty\n\t\tconst qValues = initQuorumValuesFromCodeDetails(codeDetails);\n\t\tthis.initializeProtocolState(\n\t\t\tattributes,\n\t\t\t{\n\t\t\t\tmembers: [],\n\t\t\t\tproposals: [],\n\t\t\t\tvalues: qValues,\n\t\t\t}, // IQuorumSnapShot\n\t\t);\n\n\t\tawait this.instantiateRuntime(codeDetails, undefined);\n\n\t\tthis.setLoaded();\n\t}\n\n\tprivate async rehydrateDetachedFromSnapshot({\n\t\tbaseSnapshot,\n\t\tsnapshotBlobs,\n\t\thasAttachmentBlobs,\n\t\tattachmentBlobs,\n\t\tpendingRuntimeState,\n\t}: IPendingDetachedContainerState): Promise<void> {\n\t\tif (hasAttachmentBlobs) {\n\t\t\tif (attachmentBlobs !== undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tthis.detachedBlobStorage !== undefined,\n\t\t\t\t\t0xb8e /* detached blob storage should always exist when detached */,\n\t\t\t\t);\n\t\t\t\ttryInitializeMemoryDetachedBlobStorage(this.detachedBlobStorage, attachmentBlobs);\n\t\t\t}\n\t\t\tassert(\n\t\t\t\tthis.detachedBlobStorage !== undefined && this.detachedBlobStorage.size > 0,\n\t\t\t\t0x250 /* \"serialized container with attachment blobs must be rehydrated with detached blob storage\" */,\n\t\t\t);\n\t\t}\n\n\t\tconst snapshot = convertSnapshotInfoToSnapshot({\n\t\t\tbaseSnapshot,\n\t\t\tsnapshotBlobs,\n\t\t\tsnapshotSequenceNumber: 0,\n\t\t});\n\n\t\tthis.storageAdapter.cacheSnapshotBlobs(snapshot.blobContents);\n\t\tconst attributes = await getDocumentAttributes(this.storageAdapter, snapshot.snapshotTree);\n\n\t\tawait this.attachDeltaManagerOpHandler(attributes);\n\n\t\t// Initialize the protocol handler\n\t\tconst baseTree = getProtocolSnapshotTree(snapshot.snapshotTree);\n\t\tconst qValues = await readAndParse<[string, ICommittedProposal][]>(\n\t\t\tthis.storageAdapter,\n\t\t\tbaseTree.blobs.quorumValues,\n\t\t);\n\t\tthis.initializeProtocolState(\n\t\t\tattributes,\n\t\t\t{\n\t\t\t\tmembers: [],\n\t\t\t\tproposals: [],\n\t\t\t\tvalues: qValues,\n\t\t\t}, // IQuorumSnapShot\n\t\t);\n\t\tconst codeDetails = this.getCodeDetailsFromQuorum();\n\n\t\tawait this.instantiateRuntime(\n\t\t\tcodeDetails,\n\t\t\tcombineSnapshotTreeAndSnapshotBlobs(snapshot),\n\t\t\tpendingRuntimeState,\n\t\t\tsnapshot,\n\t\t);\n\n\t\tthis.setLoaded();\n\t}\n\n\tprivate async initializeProtocolStateFromSnapshot(\n\t\tattributes: IDocumentAttributes,\n\t\tstorage: IContainerStorageService,\n\t\tsnapshot: ISnapshotTree | undefined,\n\t): Promise<void> {\n\t\tconst quorumSnapshot: IQuorumSnapshot = {\n\t\t\tmembers: [],\n\t\t\tproposals: [],\n\t\t\tvalues: [],\n\t\t};\n\n\t\tif (snapshot !== undefined) {\n\t\t\tconst baseTree = getProtocolSnapshotTree(snapshot);\n\t\t\t[quorumSnapshot.members, quorumSnapshot.proposals, quorumSnapshot.values] =\n\t\t\t\tawait Promise.all([\n\t\t\t\t\treadAndParse<[string, ISequencedClient][]>(storage, baseTree.blobs.quorumMembers),\n\t\t\t\t\treadAndParse<[number, ISequencedProposal, string[]][]>(\n\t\t\t\t\t\tstorage,\n\t\t\t\t\t\tbaseTree.blobs.quorumProposals,\n\t\t\t\t\t),\n\t\t\t\t\treadAndParse<[string, ICommittedProposal][]>(storage, baseTree.blobs.quorumValues),\n\t\t\t\t]);\n\t\t}\n\n\t\tthis.initializeProtocolState(attributes, quorumSnapshot);\n\t}\n\n\tprivate initializeProtocolState(\n\t\tattributes: IDocumentAttributes,\n\t\tquorumSnapshot: IQuorumSnapshot,\n\t): void {\n\t\tconst protocol = this.protocolHandlerBuilder(attributes, quorumSnapshot, (key, value) =>\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\tthis.submitMessage(MessageType.Propose, JSON.stringify({ key, value })),\n\t\t);\n\n\t\tconst protocolLogger = createChildLogger({\n\t\t\tlogger: this.subLogger,\n\t\t\tnamespace: \"ProtocolHandler\",\n\t\t});\n\n\t\tprotocol.quorum.on(\"error\", (error: ITelemetryErrorEventExt) => {\n\t\t\tprotocolLogger.sendErrorEvent(error);\n\t\t});\n\n\t\tprotocol.quorum.on(\"addProposal\", (proposal: ISequencedProposal) => {\n\t\t\tif (proposal.key === \"code\" || proposal.key === \"code2\") {\n\t\t\t\tthis.emit(\"codeDetailsProposed\", proposal.value, proposal);\n\t\t\t}\n\t\t});\n\n\t\tprotocol.quorum.on(\"approveProposal\", (sequenceNumber, key, value) => {\n\t\t\tif (key === \"code\" || key === \"code2\") {\n\t\t\t\tif (!isFluidCodeDetails(value)) {\n\t\t\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\t\t\teventName: \"CodeProposalNotIFluidCodeDetails\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis.processCodeProposal().catch((error) => {\n\t\t\t\t\tconst normalizedError = normalizeError(error);\n\t\t\t\t\tthis.close(normalizedError);\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\t// we need to make sure this member get set in a synchronous context,\n\t\t// or other things can happen after the object that will be set is created, but not yet set\n\t\t// this was breaking this._initialClients handling\n\t\t//\n\t\tthis._protocolHandler = protocol;\n\t}\n\n\tprivate captureProtocolSummary(): ISummaryTree {\n\t\tconst quorumSnapshot = this.protocolHandler.snapshot();\n\t\tconst summary: ISummaryTree = {\n\t\t\ttree: {\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: JSON.stringify(this.protocolHandler.attributes),\n\t\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\t},\n\t\t\t\tquorumMembers: {\n\t\t\t\t\tcontent: JSON.stringify(quorumSnapshot.members),\n\t\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\t},\n\t\t\t\tquorumProposals: {\n\t\t\t\t\tcontent: JSON.stringify(quorumSnapshot.proposals),\n\t\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\t},\n\t\t\t\tquorumValues: {\n\t\t\t\t\tcontent: JSON.stringify(quorumSnapshot.values),\n\t\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\t},\n\t\t\t},\n\t\t\ttype: SummaryType.Tree,\n\t\t};\n\n\t\treturn summary;\n\t}\n\n\tprivate getCodeDetailsFromQuorum(): IFluidCodeDetails {\n\t\tconst quorum = this.protocolHandler.quorum;\n\n\t\tconst pkg = getCodeProposal(quorum);\n\n\t\treturn pkg as IFluidCodeDetails;\n\t}\n\n\tprivate static setupClient(\n\t\tcontainerId: string,\n\t\tloaderOptionsClient?: IClient,\n\t\tclientDetailsOverride?: IClientDetails,\n\t): IClient {\n\t\tconst client: IClient =\n\t\t\tloaderOptionsClient === undefined\n\t\t\t\t? {\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\tcapabilities: { interactive: true },\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmode: \"read\", // default reconnection mode on lost connection / connection error\n\t\t\t\t\t\tpermission: [],\n\t\t\t\t\t\tscopes: [],\n\t\t\t\t\t\tuser: { id: \"\" },\n\t\t\t\t\t}\n\t\t\t\t: structuredClone(loaderOptionsClient);\n\n\t\tif (clientDetailsOverride !== undefined) {\n\t\t\tclient.details = {\n\t\t\t\t...client.details,\n\t\t\t\t...clientDetailsOverride,\n\t\t\t\tcapabilities: {\n\t\t\t\t\t...client.details.capabilities,\n\t\t\t\t\t...clientDetailsOverride?.capabilities,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tclient.details.environment = [\n\t\t\tclient.details.environment,\n\t\t\t` loaderVersion:${pkgVersion}`,\n\t\t\t` containerId:${containerId}`,\n\t\t].join(\";\");\n\n\t\treturn client;\n\t}\n\n\t/**\n\t * Returns true if connection is active, i.e. it's \"write\" connection and\n\t * container runtime was notified about this connection (i.e. we are up-to-date and could send ops).\n\t * This happens after client received its own joinOp and thus is in the quorum.\n\t * If it's not true, runtime is not in position to send ops.\n\t */\n\tprivate activeConnection(): boolean {\n\t\treturn (\n\t\t\tthis.connectionState === ConnectionState.Connected && this.connectionMode === \"write\"\n\t\t);\n\t}\n\n\tprivate createDeltaManager(): DeltaManager<ConnectionManager> {\n\t\tconst serviceProvider = (): IDocumentService | undefined => this.service;\n\t\tconst deltaManager = new DeltaManager<ConnectionManager>(\n\t\t\tserviceProvider,\n\t\t\tcreateChildLogger({ logger: this.subLogger, namespace: \"DeltaManager\" }),\n\t\t\t() => this.activeConnection(),\n\t\t\t(props: IConnectionManagerFactoryArgs) =>\n\t\t\t\tnew ConnectionManager(\n\t\t\t\t\tserviceProvider,\n\t\t\t\t\t() => this.isDirty,\n\t\t\t\t\tthis.client,\n\t\t\t\t\tthis._canReconnect,\n\t\t\t\t\tcreateChildLogger({ logger: this.subLogger, namespace: \"ConnectionManager\" }),\n\t\t\t\t\tprops,\n\t\t\t\t),\n\t\t);\n\n\t\t// Disable inbound queues as Container is not ready to accept any ops until we are fully loaded!\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tdeltaManager.inbound.pause();\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tdeltaManager.inboundSignal.pause();\n\n\t\tdeltaManager.on(\"connect\", (details: IConnectionDetailsInternal, _opsBehind?: number) => {\n\t\t\tassert(this.connectionMode === details.mode, 0x4b7 /* mismatch */);\n\n\t\t\t// Delay raising events until setLoaded()\n\t\t\t// Here are some of the reasons why this design is chosen:\n\t\t\t// 1. Various processes track speed of connection. But we are not processing ops or signal while container is loading,\n\t\t\t// and thus we can't move forward across connection modes. This results in telemetry errors (like NoJoinOp) that\n\t\t\t// have nothing to do with connection flow itself\n\t\t\t// 2. This also makes it hard to reason about recovery (like reconnection) in case we might have lost JoinSignal. Reconnecting\n\t\t\t// in loading phase is useless (get back to same state), but at the same time not doing it may result in broken connection\n\t\t\t// without recovery (after we loaded).\n\t\t\t// 3. We expose non-consistent view. ContainerRuntime may start loading in non-connected state, but end in connected, with\n\t\t\t// no events telling about it (until we loaded). Most of the code relies on a fact that state changes when events fire.\n\t\t\t// This will not delay any processes (as observed by the user). I.e. once container moves to loaded phase,\n\t\t\t// we immediately would transition across all phases, if we have proper signals / ops ready.\n\t\t\tif (this.loaded) {\n\t\t\t\tthis.connectionStateHandler.receivedConnectEvent(details);\n\t\t\t}\n\t\t});\n\n\t\tdeltaManager.on(\"establishingConnection\", (reason: IConnectionStateChangeReason) => {\n\t\t\tthis.connectionStateHandler.establishingConnection(reason);\n\t\t});\n\n\t\tdeltaManager.on(\"cancelEstablishingConnection\", (reason: IConnectionStateChangeReason) => {\n\t\t\tthis.connectionStateHandler.cancelEstablishingConnection(reason);\n\t\t});\n\n\t\tdeltaManager.on(\"disconnect\", (text, error) => {\n\t\t\tthis.noopHeuristic?.notifyDisconnect();\n\t\t\tconst reason = { text, error };\n\t\t\t// Symmetry with \"connect\" events\n\t\t\tif (this.loaded) {\n\t\t\t\tthis.connectionStateHandler.receivedDisconnectEvent(reason);\n\t\t\t} else if (!this.closed) {\n\t\t\t\t// Raise cancellation to get state machine back to initial state\n\t\t\t\tthis.connectionStateHandler.cancelEstablishingConnection(reason);\n\t\t\t}\n\t\t});\n\n\t\tdeltaManager.on(\"throttled\", (warning: IThrottlingWarning) => {\n\t\t\tconst warn = warning as ContainerWarning;\n\t\t\t// Some \"warning\" events come from outside the container and are logged\n\t\t\t// elsewhere (e.g. summarizing container). We shouldn't log these here.\n\t\t\tif (warn.logged !== true) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"ContainerWarning\" }, warn);\n\t\t\t}\n\t\t\tthis.emit(\"warning\", warn);\n\t\t});\n\n\t\tdeltaManager.on(\"readonly\", (readonly) => {\n\t\t\tif (this.loaded) {\n\t\t\t\tthis.setConnectionStatus(readonly);\n\t\t\t}\n\t\t\tthis.emit(\"readonly\", readonly);\n\t\t});\n\n\t\tdeltaManager.on(\"closed\", (error?: ICriticalContainerError) => {\n\t\t\tthis.closeCore(error);\n\t\t});\n\n\t\tdeltaManager.on(\"disposed\", (error?: ICriticalContainerError) => {\n\t\t\tthis.disposeCore(error);\n\t\t});\n\n\t\treturn deltaManager;\n\t}\n\n\tprivate async attachDeltaManagerOpHandler(\n\t\tattributes: IDocumentAttributes,\n\t\tprefetchType?: \"cached\" | \"all\" | \"none\",\n\t\tlastProcessedSequenceNumber?: number,\n\t): Promise<void> {\n\t\treturn this._deltaManager.attachOpHandler(\n\t\t\tattributes.minimumSequenceNumber /* minimumSequenceNumber */,\n\t\t\tattributes.sequenceNumber /* snapshotSequenceNumber */,\n\t\t\t{\n\t\t\t\tprocess: (message) => this.processRemoteMessage(message),\n\t\t\t\tprocessSignal: (message) => {\n\t\t\t\t\tthis.processSignal(message);\n\t\t\t\t},\n\t\t\t} /* handler to process incoming delta messages */,\n\t\t\tprefetchType,\n\t\t\tlastProcessedSequenceNumber,\n\t\t);\n\t}\n\n\tprivate logConnectionStateChangeTelemetry(\n\t\tvalue: ConnectionState,\n\t\toldState: ConnectionState,\n\t\treason?: IConnectionStateChangeReason,\n\t): void {\n\t\t// Log actual event\n\t\tconst time = performanceNow();\n\t\tthis.connectionTransitionTimes[value] = time;\n\t\tconst duration = time - this.connectionTransitionTimes[oldState];\n\n\t\tlet durationFromDisconnected: number | undefined;\n\t\tlet autoReconnect: ReconnectMode | undefined;\n\t\tlet checkpointSequenceNumber: number | undefined;\n\t\tlet opsBehind: number | undefined;\n\t\tif (value === ConnectionState.Disconnected) {\n\t\t\tautoReconnect = this._deltaManager.connectionManager.reconnectMode;\n\t\t} else {\n\t\t\tif (value === ConnectionState.Connected) {\n\t\t\t\tdurationFromDisconnected =\n\t\t\t\t\ttime - this.connectionTransitionTimes[ConnectionState.Disconnected];\n\t\t\t\tdurationFromDisconnected = formatTick(durationFromDisconnected);\n\t\t\t} else if (value === ConnectionState.CatchingUp) {\n\t\t\t\t// This info is of most interesting while Catching Up.\n\t\t\t\tcheckpointSequenceNumber = this.deltaManager.lastKnownSeqNumber;\n\t\t\t\t// Need to check that we have already loaded and fetched the snapshot.\n\t\t\t\tif (this.deltaManager.hasCheckpointSequenceNumber && this.loaded) {\n\t\t\t\t\topsBehind = checkpointSequenceNumber - this.deltaManager.lastSequenceNumber;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.mc.logger.sendPerformanceEvent(\n\t\t\t{\n\t\t\t\teventName: `ConnectionStateChange_${ConnectionState[value]}`,\n\t\t\t\tfrom: ConnectionState[oldState],\n\t\t\t\tduration,\n\t\t\t\tdurationFromDisconnected,\n\t\t\t\treason: reason?.text,\n\t\t\t\tconnectionCount: this.connectionCount,\n\t\t\t\tpendingClientId: this.connectionStateHandler.pendingClientId,\n\t\t\t\tclientId: this.connectionStateHandler.clientId,\n\t\t\t\tautoReconnect,\n\t\t\t\topsBehind,\n\t\t\t\tonline: OnlineStatus[isOnline()],\n\t\t\t\tlastVisible:\n\t\t\t\t\tthis.lastVisible === undefined ? undefined : performanceNow() - this.lastVisible,\n\t\t\t\tcheckpointSequenceNumber,\n\t\t\t\tquorumSize: this._protocolHandler?.quorum.getMembers().size,\n\t\t\t\taudienceSize: this._protocolHandler?.audience.getMembers().size,\n\t\t\t\tisDirty: this.isDirty,\n\t\t\t\t...this._deltaManager.connectionProps,\n\t\t\t},\n\t\t\treason?.error,\n\t\t);\n\n\t\tif (value === ConnectionState.Connected) {\n\t\t\tthis.connectionCount++;\n\t\t}\n\t}\n\n\tprivate propagateConnectionState(disconnectedReason?: IConnectionStateChangeReason): void {\n\t\tconst connected = this.connectionState === ConnectionState.Connected;\n\n\t\tif (connected) {\n\t\t\tconst clientId = this.connectionStateHandler.clientId;\n\t\t\tassert(clientId !== undefined, 0x96e /* there has to be clientId */);\n\t\t\tthis.protocolHandler.audience.setCurrentClientId(clientId);\n\t\t\tthis.signalAudience.setCurrentClientId(clientId);\n\t\t} else if (this.connectionState === ConnectionState.CatchingUp) {\n\t\t\t// Signal-based Audience does not wait for ops. So provide clientId\n\t\t\t// as soon as possible.\n\t\t\tconst clientId = this.connectionStateHandler.pendingClientId;\n\t\t\tassert(clientId !== undefined, 0xc89 /* catching up without clientId */);\n\t\t\tthis.signalAudience.setCurrentClientId(clientId);\n\t\t}\n\n\t\tthis.setConnectionStatus(\n\t\t\t/* readonly */ this.readOnlyInfo.readonly ?? false,\n\t\t\t/* onlyCallSetConnectionStateIfConnectedOrDisconnected */ true,\n\t\t);\n\n\t\t// We communicate only transitions to Connected & Disconnected states, skipping all other states.\n\t\t// This can be changed in the future, for example we likely should add \"CatchingUp\" event on Container.\n\t\tif (\n\t\t\tthis.connectionState !== ConnectionState.Connected &&\n\t\t\tthis.connectionState !== ConnectionState.Disconnected\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Both protocol and context should not be undefined if we got so far.\n\n\t\tthis.protocolHandler.setConnectionState(connected, this.clientId);\n\t\traiseConnectedEvent(\n\t\t\tthis.mc.logger,\n\t\t\tthis,\n\t\t\tconnected,\n\t\t\tthis.clientId,\n\t\t\tdisconnectedReason?.text,\n\t\t);\n\t}\n\n\t// back-compat: ADO #1385: Remove in the future, summary op should come through submitSummaryMessage()\n\tprivate submitContainerMessage(\n\t\ttype: MessageType,\n\t\tcontents: unknown,\n\t\tbatch?: boolean,\n\t\tmetadata?: unknown,\n\t): number {\n\t\tswitch (type) {\n\t\t\tcase MessageType.Operation: {\n\t\t\t\treturn this.submitMessage(type, JSON.stringify(contents), batch, metadata);\n\t\t\t}\n\t\t\tcase MessageType.Summarize: {\n\t\t\t\treturn this.submitSummaryMessage(contents as ISummaryContent);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst newError = new GenericError(\n\t\t\t\t\t\"invalidContainerSubmitOpType\",\n\t\t\t\t\tundefined /* error */,\n\t\t\t\t\t{ messageType: type },\n\t\t\t\t);\n\t\t\t\tthis.close(newError);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Gets the `clientSequenceNumber` of last message in a batch.\n\t */\n\tprivate submitBatch(batch: IBatchMessage[], referenceSequenceNumber?: number): number {\n\t\tlet clientSequenceNumber = -1;\n\t\tfor (const message of batch) {\n\t\t\tclientSequenceNumber = this.submitMessage(\n\t\t\t\tMessageType.Operation,\n\t\t\t\tmessage.contents,\n\t\t\t\ttrue, // batch\n\t\t\t\tmessage.metadata,\n\t\t\t\tmessage.compression,\n\t\t\t\treferenceSequenceNumber,\n\t\t\t);\n\t\t}\n\t\tthis._deltaManager.flush();\n\t\treturn clientSequenceNumber;\n\t}\n\n\tprivate submitSummaryMessage(\n\t\tsummary: ISummaryContent,\n\t\treferenceSequenceNumber?: number,\n\t): number {\n\t\t// github #6451: this is only needed for staging so the server\n\t\t// know when the protocol tree is included\n\t\t// this can be removed once all clients send\n\t\t// protocol tree by default\n\t\tif (summary.details === undefined) {\n\t\t\tsummary.details = {};\n\t\t}\n\t\tsummary.details.includesProtocolTree = this.storageAdapter.summarizeProtocolTree;\n\t\treturn this.submitMessage(\n\t\t\tMessageType.Summarize,\n\t\t\tJSON.stringify(summary),\n\t\t\tfalse /* batch */,\n\t\t\tundefined /* metadata */,\n\t\t\tundefined /* compression */,\n\t\t\treferenceSequenceNumber,\n\t\t);\n\t}\n\n\tprivate submitMessage(\n\t\ttype: MessageType,\n\t\tcontents?: string,\n\t\tbatch?: boolean,\n\t\tmetadata?: unknown,\n\t\tcompression?: string,\n\t\treferenceSequenceNumber?: number,\n\t): number {\n\t\tif (this.connectionState !== ConnectionState.Connected) {\n\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"SubmitMessageWithNoConnection\", type });\n\t\t\treturn -1;\n\t\t}\n\n\t\tthis.noopHeuristic?.notifyMessageSent();\n\t\treturn this._deltaManager.submit(\n\t\t\ttype,\n\t\t\tcontents,\n\t\t\tbatch,\n\t\t\tmetadata,\n\t\t\tcompression,\n\t\t\treferenceSequenceNumber,\n\t\t);\n\t}\n\n\t/**\n\t * Processes incoming delta messages\n\t * @param message - delta message received from the server\n\t */\n\tprivate processRemoteMessage(message: ISequencedDocumentMessage): void {\n\t\tconst local = this.clientId === message.clientId;\n\n\t\t// Allow the protocol handler to process the message\n\t\tconst result = this.protocolHandler.processMessage(message, local);\n\n\t\t// Forward messages to the loaded runtime for processing\n\t\tthis.runtime.process(message, local);\n\t\tthis.serializedStateManager.addProcessedOp(message);\n\t\t// Inactive (not in quorum or not writers) clients don't take part in the minimum sequence number calculation.\n\t\tif (this.activeConnection()) {\n\t\t\tif (this.noopHeuristic === undefined) {\n\t\t\t\tconst serviceConfiguration = this.deltaManager.serviceConfiguration;\n\t\t\t\t// Note that config from first connection will be used for this container's lifetime.\n\t\t\t\t// That means that if relay service changes settings, such changes will impact only newly booted\n\t\t\t\t// clients.\n\t\t\t\t// All existing will continue to use settings they got earlier.\n\t\t\t\tassert(\n\t\t\t\t\tserviceConfiguration !== undefined,\n\t\t\t\t\t0x2e4 /* \"there should be service config for active connection\" */,\n\t\t\t\t);\n\t\t\t\tthis.noopHeuristic = new NoopHeuristic(\n\t\t\t\t\tserviceConfiguration.noopTimeFrequency,\n\t\t\t\t\tserviceConfiguration.noopCountFrequency,\n\t\t\t\t);\n\t\t\t\tthis.noopHeuristic.on(\"wantsNoop\", () => {\n\t\t\t\t\t// On disconnect we notify the heuristic which should prevent it from wanting a noop.\n\t\t\t\t\t// Hitting this assert would imply we lost activeConnection between notifying the heuristic of a processed message and\n\t\t\t\t\t// running the microtask that the heuristic queued in response.\n\t\t\t\t\tassert(\n\t\t\t\t\t\tthis.activeConnection(),\n\t\t\t\t\t\t0x241 /* \"Trying to send noop without active connection\" */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.submitMessage(MessageType.NoOp);\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.noopHeuristic.notifyMessageProcessed(message);\n\t\t\t// The contract with the protocolHandler is that returning \"immediateNoOp\" is equivalent to \"please immediately accept the proposal I just processed\".\n\t\t\tif (result.immediateNoOp === true) {\n\t\t\t\tthis.submitMessage(MessageType.Accept);\n\t\t\t}\n\t\t}\n\n\t\tthis.emit(\"op\", message);\n\t}\n\n\t// unknown should be removed once `@alpha` tag is removed from IContainerContext\n\tprivate submitSignal(content: unknown | ISignalEnvelope, targetClientId?: string): void {\n\t\tthis._deltaManager.submitSignal(JSON.stringify(content), targetClientId);\n\t}\n\n\tprivate processSignal(message: ISignalMessage): void {\n\t\t// No clientId indicates a system signal message.\n\t\tif (protocolHandlerShouldProcessSignal(message)) {\n\t\t\tthis.protocolHandler.processSignal(message);\n\t\t} else {\n\t\t\tconst local =\n\t\t\t\t// Check against signal audience to detect current signals\n\t\t\t\t// including very early signals before reaching \"Connected\".\n\t\t\t\tmessage.clientId === this.signalAudience.getSelf()?.clientId ||\n\t\t\t\t// and use \"regular\" audience to detect signals from past\n\t\t\t\t// connection bouncing slowly back from service. This may never\n\t\t\t\t// happen, but is kept as it was used historically as the only\n\t\t\t\t// check.\n\t\t\t\tmessage.clientId === this.clientId;\n\t\t\tthis.runtime.processSignal(message, local);\n\t\t}\n\t}\n\n\tprivate async instantiateRuntime(\n\t\tcodeDetails: IFluidCodeDetails,\n\t\tsnapshotTree: ISnapshotTree | undefined,\n\t\tpendingLocalState?: unknown,\n\t\tsnapshot?: ISnapshot,\n\t): Promise<void> {\n\t\tassert(this._runtime?.disposed !== false, 0x0dd /* \"Existing runtime not disposed\" */);\n\n\t\ttry {\n\t\t\t// The relative loader will proxy requests to '/' to the loader itself assuming no non-cache flags\n\t\t\t// are set. Global requests will still go directly to the loader\n\t\t\tconst maybeLoader: FluidObject<ILoader> = this.scope;\n\t\t\tconst loader = new RelativeLoader(this, maybeLoader.ILoader);\n\n\t\t\tconst loadCodeResult = await PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.subLogger,\n\t\t\t\t{ eventName: \"CodeLoad\" },\n\t\t\t\tasync () => this.codeLoader.load(codeDetails),\n\t\t\t);\n\n\t\t\tthis._loadedModule = {\n\t\t\t\tmodule: loadCodeResult.module,\n\t\t\t\t// An older interface ICodeLoader could return an IFluidModule which didn't have details.\n\t\t\t\t// If we're using one of those older ICodeLoaders, then we fix up the module with the specified details here.\n\t\t\t\t// TODO: Determine if this is still a realistic scenario or if this fixup could be removed.\n\t\t\t\tdetails: loadCodeResult.details ?? codeDetails,\n\t\t\t};\n\n\t\t\tconst fluidExport: FluidObject<IProvideRuntimeFactory> | undefined =\n\t\t\t\tthis._loadedModule.module.fluidExport;\n\t\t\tconst runtimeFactory = fluidExport?.IRuntimeFactory;\n\t\t\tif (runtimeFactory === undefined) {\n\t\t\t\tthrow new Error(packageNotFactoryError);\n\t\t\t}\n\n\t\t\tconst existing = snapshotTree !== undefined;\n\n\t\t\tconst context = new ContainerContext({\n\t\t\t\toptions: this.options,\n\t\t\t\tscope: this.scope,\n\t\t\t\tbaseSnapshot: snapshotTree,\n\t\t\t\tversion: this._loadedFromVersion,\n\t\t\t\tdeltaManager: this._deltaManager,\n\t\t\t\tstorage: this.storageAdapter,\n\t\t\t\tquorum: this.protocolHandler.quorum,\n\t\t\t\taudience: this.protocolHandler.audience,\n\t\t\t\tsignalAudience: this.signalAudience,\n\t\t\t\tloader,\n\t\t\t\tsubmitFn: (type, contents, batch, metadata) =>\n\t\t\t\t\tthis.submitContainerMessage(type, contents, batch, metadata),\n\t\t\t\tsubmitSummaryFn: (summaryOp: ISummaryContent, referenceSequenceNumber?: number) =>\n\t\t\t\t\tthis.submitSummaryMessage(summaryOp, referenceSequenceNumber),\n\t\t\t\tsubmitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) =>\n\t\t\t\t\tthis.submitBatch(batch, referenceSequenceNumber),\n\t\t\t\tsubmitSignalFn: (content, targetClientId) =>\n\t\t\t\t\tthis.submitSignal(content, targetClientId),\n\t\t\t\tdisposeFn: (error?: ICriticalContainerError) => this.dispose(error),\n\t\t\t\tcloseFn: (error?: ICriticalContainerError) => this.close(error),\n\t\t\t\tupdateDirtyContainerState: this.updateDirtyContainerState,\n\t\t\t\tgetAbsoluteUrl: this.getAbsoluteUrl,\n\t\t\t\tgetContainerDiagnosticId: () => this.resolvedUrl?.id,\n\t\t\t\tgetClientId: () => this.clientId,\n\t\t\t\tgetAttachState: () => this.attachState,\n\t\t\t\tgetConnected: () => this.connected,\n\t\t\t\tgetConnectionState: () => this.connectionState,\n\t\t\t\tclientDetails: this._deltaManager.clientDetails,\n\t\t\t\texisting,\n\t\t\t\ttaggedLogger: this.subLogger,\n\t\t\t\tpendingLocalState,\n\t\t\t\tsnapshotWithContents: snapshot,\n\t\t\t});\n\n\t\t\tconst runtime = await PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.subLogger,\n\t\t\t\t{ eventName: \"InstantiateRuntime\" },\n\t\t\t\tasync () => runtimeFactory.instantiateRuntime(context, existing),\n\t\t\t);\n\n\t\t\t// Validate that the Runtime is compatible with this Loader.\n\t\t\tconst maybeRuntimeCompatDetails = runtime as FluidObject<ILayerCompatDetails>;\n\t\t\tvalidateRuntimeCompatibility(\n\t\t\t\tmaybeRuntimeCompatDetails.ILayerCompatDetails,\n\t\t\t\tthis.mc.logger,\n\t\t\t);\n\n\t\t\tthis._runtime = runtime;\n\t\t\tthis._lifecycleEvents.emit(\"runtimeInstantiated\");\n\t\t\tthis._loadedCodeDetails = codeDetails;\n\t\t} catch (error) {\n\t\t\tthis.dispose(normalizeError(error));\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprivate readonly updateDirtyContainerState = (dirty: boolean): void => {\n\t\tif (this._dirtyContainer === dirty) {\n\t\t\treturn;\n\t\t}\n\t\tthis._dirtyContainer = dirty;\n\t\tthis.emit(dirty ? dirtyContainerEvent : savedContainerEvent);\n\t};\n\n\t/**\n\t * Send the connected status to the runtime.\n\t * @param readonly - Is the container in readonly mode?\n\t * @param onlyCallSetConnectionStateIfConnectedOrDisconnected - If true, only\n\t * call older `setConnectionState` on the runtime if the connection state is\n\t * either Connected or Disconnected. This exists to preserve older behavior\n\t * where the runtime was only notified of these two states.\n\t */\n\tprivate setConnectionStatus(\n\t\treadonly: boolean,\n\t\tonlyCallSetConnectionStateIfConnectedOrDisconnected: boolean = false,\n\t): void {\n\t\tif (this._runtime?.disposed === false && this.loaded) {\n\t\t\tconst setConnectionStatus = this.runtime.setConnectionStatus?.bind(this.runtime);\n\t\t\tif (setConnectionStatus === undefined) {\n\t\t\t\tif (\n\t\t\t\t\t!onlyCallSetConnectionStateIfConnectedOrDisconnected ||\n\t\t\t\t\tthis.connectionState === ConnectionState.Connected ||\n\t\t\t\t\tthis.connectionState === ConnectionState.Disconnected\n\t\t\t\t) {\n\t\t\t\t\tthis.runtime.setConnectionState(\n\t\t\t\t\t\tthis.connectionState === ConnectionState.Connected &&\n\t\t\t\t\t\t\t!readonly /* container can send ops if connected to service and not in readonly mode */,\n\t\t\t\t\t\tthis.clientId,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst pendingClientConnectionId = this.connectionStateHandler.pendingClientId;\n\t\t\t\tconst connectionState = this.connectionState;\n\t\t\t\tswitch (connectionState) {\n\t\t\t\t\tcase ConnectionState.EstablishingConnection: {\n\t\t\t\t\t\tsetConnectionStatus({\n\t\t\t\t\t\t\tconnectionState,\n\t\t\t\t\t\t\tcanSendOps: false,\n\t\t\t\t\t\t\treadonly,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase ConnectionState.CatchingUp: {\n\t\t\t\t\t\t// When catching up, we have a pending clientId, but it\n\t\t\t\t\t\t// is not usable for ops. Send clientId with canSendOps false.\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tpendingClientConnectionId !== undefined,\n\t\t\t\t\t\t\t0xc8a /* catching up without clientId */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tsetConnectionStatus({\n\t\t\t\t\t\t\tconnectionState,\n\t\t\t\t\t\t\tpendingClientConnectionId,\n\t\t\t\t\t\t\tcanSendOps: false,\n\t\t\t\t\t\t\treadonly,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase ConnectionState.Connected: {\n\t\t\t\t\t\t// When connected, we have an active clientId. Pass it along\n\t\t\t\t\t\t// with canSendOps true/false based on readonly.\n\t\t\t\t\t\tconst clientConnectionId = this.clientId;\n\t\t\t\t\t\tassert(clientConnectionId !== undefined, 0xc8b /* connected without clientId */);\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tclientConnectionId === pendingClientConnectionId,\n\t\t\t\t\t\t\t0xc8c /* connected with different clientId than pending */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tsetConnectionStatus({\n\t\t\t\t\t\t\tconnectionState,\n\t\t\t\t\t\t\tclientConnectionId,\n\t\t\t\t\t\t\tcanSendOps: !readonly,\n\t\t\t\t\t\t\treadonly,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase ConnectionState.Disconnected: {\n\t\t\t\t\t\tsetConnectionStatus({\n\t\t\t\t\t\t\tconnectionState,\n\t\t\t\t\t\t\tpriorPendingClientConnectionId: pendingClientConnectionId,\n\t\t\t\t\t\t\tpriorConnectedClientConnectionId: this.clientId,\n\t\t\t\t\t\t\tcanSendOps: false,\n\t\t\t\t\t\t\treadonly,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t// No default\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate handleDeltaConnectionArg(\n\t\tdeltaConnectionArg?: \"none\" | \"delayed\",\n\t\tconnectionArgs?: IConnectionArgs,\n\t): void {\n\t\t// This ensures that we allow transitions to \"connected\" state only after container has been fully loaded\n\t\t// and we propagate such events to container runtime. All events prior to being loaded are ignored.\n\t\t// This means if we get here in non-loaded state, we might not deliver proper events to container runtime,\n\t\t// and runtime implementation may miss such events.\n\t\tassert(\n\t\t\tthis.loaded,\n\t\t\t0x96f /* has to be called after container transitions to loaded state */,\n\t\t);\n\n\t\tswitch (deltaConnectionArg) {\n\t\t\tcase undefined: {\n\t\t\t\tif (connectionArgs) {\n\t\t\t\t\t// connect to delta stream now since we did not before\n\t\t\t\t\tthis.connectToDeltaStream(connectionArgs);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// intentional fallthrough\n\t\t\tcase \"delayed\": {\n\t\t\t\tassert(\n\t\t\t\t\tthis.inboundQueuePausedFromInit,\n\t\t\t\t\t0x346 /* inboundQueuePausedFromInit should be true */,\n\t\t\t\t);\n\t\t\t\tthis.inboundQueuePausedFromInit = false;\n\t\t\t\tthis._deltaManager.inbound.resume();\n\t\t\t\tthis._deltaManager.inboundSignal.resume();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"none\": {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(deltaConnectionArg);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * IContainer interface that includes experimental features still under development.\n * @alpha @legacy @sealed\n */\nexport interface ContainerAlpha extends IContainer {\n\t/**\n\t * Get pending state from container. WARNING: misuse of this API can result in duplicate op\n\t * submission and potential document corruption. The blob returned MUST be deleted if and when this\n\t * container emits a \"connected\" event.\n\t * @returns serialized blob that can be passed to Loader.resolve()\n\t */\n\tgetPendingLocalState(): Promise<string>;\n}\n\n/**\n * Converts types to their alpha counterparts to expose alpha functionality.\n * @legacy @alpha\n */\nexport function asLegacyAlpha(base: IContainer): ContainerAlpha {\n\treturn base as ContainerAlpha;\n}\n"]}