Feat v0.8.1 workspace module (#68)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-frontend (push) Has been skipped
CI/CD / test-runners (push) Has been skipped
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-go-pg (push) Successful in 2m49s
CI/CD / test-sqlite (push) Successful in 2m54s
CI/CD / build-and-deploy (push) Successful in 36s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #68.
This commit is contained in:
2026-04-03 00:38:40 +00:00
committed by xcaliber
parent 694779fac6
commit 435f972ded
9 changed files with 681 additions and 6 deletions

View File

@@ -79,6 +79,8 @@ type Runner struct {
allowPrivateIPs bool
bus *events.Bus
objectStore storage.ObjectStore // nil = files module unavailable
workspaceRoot string // empty = workspace module unavailable
workspaceQuota int // MB, 0 = unlimited
}
// NewRunner creates a runner with the given sandbox and dependencies.
@@ -123,6 +125,13 @@ func (r *Runner) SetObjectStore(s storage.ObjectStore) {
r.objectStore = s
}
// SetWorkspaceRoot sets the base directory for extension workspaces.
// quotaMB is the per-extension quota in MB (0 = unlimited).
func (r *Runner) SetWorkspaceRoot(root string, quotaMB int) {
r.workspaceRoot = root
r.workspaceQuota = quotaMB
}
// SetAllowPrivateIPs disables the SSRF check that blocks connections to
// private/loopback IPs. For self-hosted environments where extensions
// reach internal services. Controlled by EXT_ALLOW_PRIVATE_IPS env var.
@@ -392,6 +401,15 @@ func (r *Runner) buildModulesWithLibCtx(ctx context.Context, packageID string, m
modules["realtime"] = BuildRealtimeModule(ctx, r.bus, packageID)
}
case models.ExtPermWorkspaceManage:
if r.workspaceRoot != "" {
modules["workspace"] = BuildWorkspaceModule(ctx, WorkspaceModuleConfig{
PackageID: packageID,
WorkspaceRoot: r.workspaceRoot,
QuotaMB: r.workspaceQuota,
})
}
case models.ExtPermBatchExec:
hasBatchExec = true
}