From a07ffbc4be6ba31deb21da5ad328fa43f34cc8d9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 Aug 2025 16:37:42 +0000 Subject: [PATCH 1/3] Initial plan From 7fc1c217c0962d3ae8922983ecbff6515890a2bb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 Aug 2025 16:43:25 +0000 Subject: [PATCH 2/3] feat: add FileSystem observer API types Co-authored-by: streamich <9773803+streamich@users.noreply.github.com> --- src/fsa/types.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/fsa/types.ts b/src/fsa/types.ts index e87dfd21c..4023ca1a0 100644 --- a/src/fsa/types.ts +++ b/src/fsa/types.ts @@ -126,3 +126,32 @@ export type Data = | DataView | Blob | string; + +/** + * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemChangeRecord + */ +export interface FileSystemChangeRecord { + /** The changed file system handle. */ + changedHandle: IFileSystemHandle; + /** Path components from the observed directory to the changed handle. */ + relativePathComponents: string[]; + /** The type of change that occurred. */ + type: 'appeared' | 'disappeared' | 'modified'; +} + +export interface FileSystemObserverObserveOptions { + /** Whether to observe changes recursively in subdirectories. */ + recursive?: boolean; +} + +/** + * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemObserver + */ +export interface FileSystemObserver { + /** Start observing changes to a directory handle. */ + observe(handle: IFileSystemDirectoryHandle, options?: FileSystemObserverObserveOptions): Promise; + /** Stop observing changes to a directory handle. */ + unobserve(handle: IFileSystemDirectoryHandle): void; + /** Disconnect and stop all observations. */ + disconnect(): void; +} From 38e2f13856eaedfbca83eae7770f07a755e74c91 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 Aug 2025 21:05:50 +0000 Subject: [PATCH 3/3] feat: update FileSystem observer API types with complete spec compliance Co-authored-by: streamich <9773803+streamich@users.noreply.github.com> --- src/fsa/types.ts | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/fsa/types.ts b/src/fsa/types.ts index 4023ca1a0..8af90fc6d 100644 --- a/src/fsa/types.ts +++ b/src/fsa/types.ts @@ -131,12 +131,26 @@ export type Data = * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemChangeRecord */ export interface FileSystemChangeRecord { - /** The changed file system handle. */ - changedHandle: IFileSystemHandle; + /** + * The changed file system handle. + * This property will be null for records with a "disappeared", "errored", or "unknown" type. + */ + changedHandle: IFileSystemHandle | IFileSystemSyncAccessHandle | null; /** Path components from the observed directory to the changed handle. */ relativePathComponents: string[]; + /** + * Path components that make up the relative file path from the root to the + * changedHandle's former location, in the case of observations with a "moved" type. + * If the type is not "moved", this property will be null. + */ + relativePathMovedFrom: string[] | null; + /** + * A reference to the root file system handle, that is, the one passed to the observe() + * call that started the observation. + */ + root: IFileSystemHandle | IFileSystemSyncAccessHandle; /** The type of change that occurred. */ - type: 'appeared' | 'disappeared' | 'modified'; + type: 'appeared' | 'disappeared' | 'modified' | 'moved' | 'errored' | 'unknown'; } export interface FileSystemObserverObserveOptions { @@ -147,7 +161,13 @@ export interface FileSystemObserverObserveOptions { /** * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemObserver */ -export interface FileSystemObserver { +export interface IFileSystemObserver { + /** + * Constructor for creating a FileSystemObserver. + * @param callback - Function called with file system change records and the observer instance + */ + new (callback: (records: FileSystemChangeRecord[], observer: IFileSystemObserver) => void): IFileSystemObserver; + /** Start observing changes to a directory handle. */ observe(handle: IFileSystemDirectoryHandle, options?: FileSystemObserverObserveOptions): Promise; /** Stop observing changes to a directory handle. */