- the agent detects the change, sends it to the manager
- the manager sends the change to an authenticated API endpoint
- the API process the change (uploads the file if binary, updates the DB)
- the manager sends an external change notification to all connected clients
- the client refetches the sandbox contents (lazy fetching?)
- use node-watch / chokidar
- detect
- added file / folder
- changed file content
- deleted file / folder
- (renamed file / folder?)
 
- exclude node_modules
- exclude based on .gitignore
- (maybe also exclude on .syncignore?)
- debounce changes
- POST /api/v1/sandboxes/${sandboxId}/msync
- authentication?
- data
- sandbox id (in URL)
- file / folder name, relative to the root of the sandbox, ex.: /src/components/Hello.vue
- type - "file"or"folder"
- if type is file, the file content (base64 encoded); if the file was deleted, content isnull
- (new name, in case of a rename?)
 
Example:
POST /api/v1/sandboxes/qv463kv6z6/msync
{
    "name": "/src/components/Hello.vue",
    "type": "file",
    "content": "<template>..."
}Comments:
- typecan be inferred from the existence of the- contentfield- nameand- content: null)
- should we use multipart/form-data, which supports binary content, or JSON body with base64 encoded content?
- maybe also have an operationfield, with"change"or"delete"values, and not usecontent: nullfor deletes?