PSA/ee/docs/extension-system/registry_implementation.md
Hermes 284313f908
Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Initial import of AlgaPSA codebase from PSA server
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz

Source: /opt/alga-psa on psa.joliet.tech
2026-06-22 16:12:17 -05:00

73 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Extension Registry Implementation (v2)
The registry catalogs extensions, versions, and bundles and tracks pertenant installs with granted capabilities and configuration. This is the authoritative source for manifest resolution, content hashes, signatures, and install state in the v2 architecture.
## Data Model (Initial)
- `extension_registry(id, name, publisher, latest_version, deprecation, created_at)`
- `extension_version(id, registry_id, semver, content_hash, signature, sbom_ref, created_at)`
- `extension_bundle(id, content_hash, storage_url, size, runtime, sdk_version)`
- `tenant_extension_install(id, tenant_id, registry_id, version_id, status, granted_caps, config, created_at)`
- `extension_event_subscription(id, tenant_install_id, event, filter, created_at)`
- `extension_execution_log(id, tenant_id, extension_id, event_id, started_at, finished_at, status, metrics, error)`
- `extension_quota_usage(tenant_id, extension_id, window_start, cpu_ms, mem_mb_ms, invocations, egress_bytes)`
Tenant isolation enforced via RLS and query predicates.
## Services
### Registry Service
- `createRegistryEntry({ name, publisher })`
- `listRegistryEntries(filter)`
- `getRegistryEntry(id)`
- `addVersion(registryId, { semver, content_hash, signature, runtime, precompiled, api, ui, sbom_ref })`
- `deprecate(registryId, reason)`
### Install Service
- `install(tenantId, registryId, semver, { granted_caps, config })` → creates `tenant_extension_install`
- `uninstall(tenantId, registryId)`
- `enable(tenantId, registryId)` / `disable(tenantId, registryId)`
- `update(tenantId, registryId, semver)`
### Signature Verification
- Load trust bundle from `SIGNING_TRUST_BUNDLE` (PEM)
- Verify bundle signature and content hash for `content_hash`
## Bundle Access
- Object storage (S3 compatible) is the source of truth
- Helpers:
- `getBundleStream(contentHash)`
- `getBundleIndex(contentHash)`
- `extractSubtree(contentHash, subtree, dest)` for `dist/` and `ui/`
## Gateway Integration
- Route: `/api/ext/[extensionId]/[[...path]]`
- Steps:
1. Resolve tenant install for `extensionId`
2. Resolve active `version_id → content_hash`
3. Load manifest for that version and match endpoint `{method, path}`
4. Call Runner `/v1/execute` with normalized request
Gateway scaffold: [server/src/app/api/ext/[extensionId]/[[...path]]/route.ts](../../../server/src/app/api/ext/%5BextensionId%5D/%5B%5B...path%5D%5D/route.ts)
## Observability
- Execution logs persisted to `extension_execution_log` with correlation IDs
- Prometheus metrics exposed by Runner; include duration, memory, fuel, egress bytes, errors
## Security & Policy
- Capability grants recorded at install; host imports blocked for missing capabilities
- Egress allowlists per tenant/extension for `http.fetch`
- Secrets retrieved via secret manager handles (no plaintext storage)
- Quotas enforced at gateway and Runner
## References
- [Manifest v2](manifest_schema.md)
- [API Routing Guide](api-routing-guide.md)
- [Security & Signing](security_signing.md)
- Registry v2 service scaffold: [ExtensionRegistryServiceV2](ee/server/src/lib/extensions/registry-v2.ts:48)