mgamadeus / ddd-clouddrive
Cloud drive for mgamadeus/ddd: spaces with host-owned rights, versioned files in object storage, search, processing in a sandbox, and an optional agent mount for ddd-agents
Requires
- php: >=8.3
- mgamadeus/ddd: ^3.39.1
Requires (Dev)
- mgamadeus/ddd-agents: ^0.1.29
- phpunit/phpunit: ^9.5
Suggests
- async-aws/s3: The object store of the file bytes (any S3-compatible service)
- mgamadeus/ddd-agents: ^0.1.26 — mounts drive spaces into the agent workspace and adds the drive tools and widgets (^0.1.29: a scratch drive per eval case)
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-23 04:33:59 UTC
README
Cloud drive for mgamadeus/ddd: spaces whose rights the host decides, folders and versioned files whose bytes live in object storage, working copies for agent sandboxes and, beside mgamadeus/ddd-agents, the agent's drive mount and tools.
What it does
- Spaces (
DriveSpace): one tree per space, an audience fixed at creation (INTERNALorSHARED), quota, largest file and retention perspaceKind(config/app/CloudDrive/spaceKinds.php). The host extendsDriveSpaceat the same path with its anchor columns. - Rights: the host's space repository answers read, write and manage in one method,
DBDriveSpace::applyRightsToSpaceQuery(); every drive table filters through it. Default: admins everything, everyone else nothing.DriveSpaceRightsContractTestCaseis the test a host runs against its rules. - Files: folders, files, versions (
DriveFileVersion) and blobs (DriveBlob). Names are case-sensitive and unique per folder; trash and restore; tags and descriptions; a change feed (DriveChangeEvent). - Bytes: direct presigned upload and download, PHP never proxies bytes. Every object is written once: a key per
blob,
If-None-Match: *signed into each PUT, multipart uploads completed only by the server onto a free key,Content-MD5verified by the store. The ingest computes the SHA-256, scans (clamscan), deduplicates per space and releases or blocks. People read only released content (DriveContentGrantsService). - Working copies (
DriveWorkingCopiesService): a sandbox saves changes (stageChanges()), commits them with a compare and swap on each file's newest version (commitChanges()), pulls what others changed (findChangesSince()). A conflict is never overwritten: it stays saved until it is resolved with mine, theirs or both.DriveTextMergeServicemerges text three-way withgit merge-file. - Agent part (only with ddd-agents installed): the drive store behind
agent.drive(CloudDriveAgentDriveStoreService), the mount resolver a host overrides (DriveSpaceMountResolverService), the tool packageclouddrive(driveStatus,commitDriveChanges,findDriveFiles,getDriveFile,organizeDriveFiles,trashDriveFiles,restoreDriveFiles,showDriveLocation), the widgetDriveLocationand the skillAssistant.Drive.
Install
composer require mgamadeus/ddd-clouddrive async-aws/s3
- An object store named
clouddrive(config/app/Common/ObjectStorage.php,OBJECT_STORAGE_CLOUDDRIVE_*). A store that ignoresIf-None-Matchon PUT setsconditionalWrites: false. Bucket CORS for the app origins; a lifecycle rule that aborts unfinished multipart uploads. - The tables: generate the models (
app:generate-doctrine-models-for-entities) and apply the schema diff. - A
DriveSpacesubclass at the same path with the host's anchor columns, and its repository'sapplyRightsToSpaceQuery(). - The REST endpoints: one controller with
use CloudDriveControllerTrait;(#[Route('/common/cloudDrive')]).POST …/cardshydrates theDriveFileswidget with short-lived open, download and thumbnail URLs. It is a POST (the references are a body) but only reads: a host write guard that classifies routes by method lets it through like a GET.GET …/nodes/{id}answersancestors(root first) for breadcrumbs and deep links. - A cron for
app:drive:maintain(every 15 minutes or hourly): system-folder expiry, trash and version retention, failed scans and lost ingests again, the blob sweep. A scan takes seconds (clamscan loads its signatures each time): withasyncIngest: truethe ingest runs in a worker — routeDriveIngestVersionMessageto a transportdrive_ingestand give it a consumer (worker list). - With ddd-agents: override
DriveSpaceMountResolverService(own drive per agent space, further mounts, andfindWorkingCopyKeyOfCall()when the sandbox's workspace key is not on every call; without a key the tools use the own drive's newest working copy) and bind the skill inconfig/app/AI/skillPackages.php:'Assistant.Drive' => ['clouddrive', 'agent.drive']. A working copy entry'sconversationKeyis the id of the delegation tree's root conversation.
app:drive:spaces:create creates a library space.
Evals (ddd-agents ≥ 0.1.29): every case gets a throwaway own drive seeded from its scratchFiles; further mounts are
read-only during the case; the space is erased at the end (--keepWorkspace keeps it).
License
MIT