Compliance export primitives for the Glide agent activity log. The package covers four concerns that every compliant export pipeline shares: validating the requested range against the OSS plan §M4 quota, splitting multi-year requests into calendar-month shards (one DB row per shard), building the signed JSON envelope that ships to the reviewer, and keeping S3 signed URLs from expiring between the time a job enqueues and the time the operator’s UI polls for it. A fifth concern — retention lifecycle — is handled by three concrete S3 storage adapters that share aDocumentation Index
Fetch the complete documentation index at: https://glide-9da73dea.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
RetentionStorage interface. The retention-sweep cron
picks a storage class per row based on its age tier without coupling to the
concrete S3 client.
The package is DB-agnostic and S3-client-agnostic. Operators wire their own
@aws-sdk/client-s3 instance, storage bucket, and DB driver.
Install
Why not bundle the S3 client?
Taking@aws-sdk/client-s3 as a hard dependency would pin the major version and
add ~2 MB to every install even for operators who archive to GCS or Cloudflare
R2. The S3SendableClient and S3CommandFactory interfaces accept any object
whose send() method returns the expected shape — the AWS SDK satisfies them out
of the box; a GCS presigned-URL shim satisfies them with a thin adapter.
The same logic applies to the DB: export envelope rows live in compliance_exports
however the operator manages that table, and the package makes no assumption
about the ORM or driver.
Range validation and monthly sharding
The OSS plan §M4 caps a single export at one year.validateRange enforces
this; splitIntoMonthlyShards produces one UTC calendar-month shard per month
in a longer range, each safe to pass as a single-shot export:
validateRange only checks the temporal span.
Building a JSON envelope
buildEnvelope assembles the signed JSON shape that ships in
compliance.exportJson (sync path) or inside the async PDF body. The envelope
carries the entity ID, display name, export range, and one row per activity-log
entry. Per-row fields include the on-chain tx hash (if any), risk verdict, policy
version, and redactedFieldsBitmap — the UI renders [REDACTED] for fields
whose bit is set:
ComplianceExportRowSchema and ComplianceExportEnvelopeSchema are
exported for callers that want to validate an envelope they received rather than
build one.
Refreshing S3 signed URLs
Signed URLs expire. When the operator’s admin UI polls a long-running export job, the URL from the initialPutObject may already be stale. refreshSignedUrl
handles the cache-and-refresh pattern: it re-signs only when the cached URL is
absent or will expire within a configurable threshold (default: 5 minutes):
Retention-tier storage adapters
Activity log rows age through four tiers: hot (0–7d, Postgres), warm (7–90d, Postgres), cold (90–365d, S3), and regulatory (1–7y, S3 Deep Archive). The three concrete adapters all implementRetentionStorage so the sweep cron can swap
storage class without changing the calling code:
| Class | S3 tier | Retrieval latency | Recommended for |
|---|---|---|---|
S3StandardStorage | STANDARD | milliseconds | Cold tier without Glacier |
S3GlacierInstantStorage | GLACIER_IR | milliseconds | Cold tier default (OSS plan) |
S3GlacierDeepStorage | DEEP_ARCHIVE | minutes–hours | Regulatory tier (1–7y) |
Quotas summary
| Rule | Enforced by |
|---|---|
| Max 10 exports per tenant/day | tRPC router layer |
| Max 1 year per export range | validateRange |
| Long-range fragmentation | splitIntoMonthlyShards |
Reading list
@glideco/agent-events— the event-type schemas that populate the rows this package exports.@glideco/dsar— setsredactedFieldsBitmapon rows; the envelope builder surfaces those bits to the reviewer.- Receipt schema —
the on-chain receipt shape referenced in
onChainTxenvelope fields. - Source on GitHub