Search by

mgamadeus / ddd-clouddrive

mgamadeus

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

Package info

github.com/ddd-framework/ddd-clouddrive

pkg:composer/mgamadeus/ddd-clouddrive

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0-rc.8 2026-11-23 04:32 UTC

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 (INTERNAL or SHARED), quota, largest file and retention per spaceKind (config/app/CloudDrive/spaceKinds.php). The host extends DriveSpace at 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. DriveSpaceRightsContractTestCase is 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-MD5 verified 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. DriveTextMergeService merges text three-way with git 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 package clouddrive (driveStatus, commitDriveChanges, findDriveFiles, getDriveFile, organizeDriveFiles, trashDriveFiles, restoreDriveFiles, showDriveLocation), the widget DriveLocation and the skill Assistant.Drive.

Install

composer require mgamadeus/ddd-clouddrive async-aws/s3
  1. An object store named clouddrive (config/app/Common/ObjectStorage.php, OBJECT_STORAGE_CLOUDDRIVE_*). A store that ignores If-None-Match on PUT sets conditionalWrites: false. Bucket CORS for the app origins; a lifecycle rule that aborts unfinished multipart uploads.
  2. The tables: generate the models (app:generate-doctrine-models-for-entities) and apply the schema diff.
  3. A DriveSpace subclass at the same path with the host's anchor columns, and its repository's applyRightsToSpaceQuery().
  4. The REST endpoints: one controller with use CloudDriveControllerTrait; (#[Route('/common/cloudDrive')]). POST …/cards hydrates the DriveFiles widget 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} answers ancestors (root first) for breadcrumbs and deep links.
  5. 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): with asyncIngest: true the ingest runs in a worker — route DriveIngestVersionMessage to a transport drive_ingest and give it a consumer (worker list).
  6. With ddd-agents: override DriveSpaceMountResolverService (own drive per agent space, further mounts, and findWorkingCopyKeyOfCall() 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 in config/app/AI/skillPackages.php: 'Assistant.Drive' => ['clouddrive', 'agent.drive']. A working copy entry's conversationKey is 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