NAVIGATION
ELOWEN DOCUMENTATION

Last updated: 10 October 2026

Browse documentation · onedrive implementation
Developer reference

onedrive implementation

Sync implementation boundaries

Maintainer section: the content below describes the code that owns each rule. It is not needed to use the plugin.

src/cycle.ts owns the shared CycleFence.check() and deletion-valve decision used by both sync planners. Call the fence before the next operation, after awaited work before a baseline or status write, and before finishing the cycle. It checks the current stored link and renews the existing worker claim by elapsed time; it needs one link read per check and a renewal only when due, with no Graph requests. An obsolete link or lost claim stops the cycle without publishing a replacement status. With no enabled mirror, no cycle runs. Each transport retains its own planner and Git execution.

src/paths.ts owns remote folder paths and conflictName(rel, when, taken). A synchronous occupancy callback returns a name immediately; a managed asynchronous callback returns a promise. Both use the same extension-preserving names and bounded collision search. src/trash.ts owns local and managed trash moves; local conflict-resolution routes reuse trashFile, while sync supplies its current-cycle check before the final rename. Internal helper imports move to their owning modules; the installed plugin entrypoint, controls and HTTP routes keep their contracts.

Managed command and browser contracts

Editor and OneDrive execute one-shot project commands with sandbox.runCommand(input, actor, options). The host authorizes the prepared target and owns byte capture, heartbeat, timeout, cancellation and lease release; the actor preserves the caller's account and allowed roots. Editor uses leaseKind: 'editor', a 30-second timeout and an 8 MiB combined output bound, returns sanitized stdout, and rejects nonzero results. OneDrive uses leaseKind: 'files', its Git timeout of 120 seconds by default, and a 64 MiB combined bound. It retains real Git exit codes and maps interrupted execution to code: null with sanitized partial output; cleanup and authorization errors remain exceptions. Missing Sandbox support makes the operation unavailable. Long-lived services retain raw prepareExecution sessions. No consumer timer or second capture loop is required.

OneDrive requires browser API 55 and uses the host's interpolate and formatBytes signatures; interpolate(template, values) handles named literal substitutions and formatBytes(bytes, viewerLocale) formats the mirror's byte count using the displayed language. Missing runtime support prevents loading rather than selecting a local fallback.

Managed file writes

Maintainer section: a managed mirror writes content up to one guest chunk with the single write operation. Larger content uses core's uploadGuestFile((operation) => this.call(operation), { path, size: bytes.length, expectedVersion, subject: rel }, [bytes]) from elowen/dist/plugins/guestUpload.js. The first argument is a callback that forwards each operation to the mirror's existing projectFiles binding, preserving its acting account, Project, workspace, expected generation and startIfNeeded: false.

Core owns chunk boundaries, acknowledgements, the resolved destination, missing parent directories and atomic version-checked commit. It aborts a failed upload and reports cleanup failure alongside the original error; begin and commit refusals retain their codes. Mirror conflicts, size limits and sync decisions remain in OneDrive. A missing or stopped environment is still unavailable, never started by a write. This adds no extra file copy or whole-file buffer beyond the downloaded bytes already held by the mirror.