Feat v0.5.2 chat surface (#32)
All checks were successful
CI/CD / detect-changes (push) Successful in 3s
CI/CD / test-frontend (push) Successful in 5s
CI/CD / test-go-pg (push) Successful in 2m28s
CI/CD / test-sqlite (push) Successful in 2m42s
CI/CD / build-and-deploy (push) Successful in 1m8s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #32.
This commit is contained in:
2026-03-30 15:25:33 +00:00
committed by xcaliber
parent 7155aaf663
commit 6931b125a4
13 changed files with 1513 additions and 23 deletions

View File

@@ -11,6 +11,7 @@ import (
"os"
"path/filepath"
"strings"
"time"
"github.com/gin-gonic/gin"
@@ -191,7 +192,21 @@ func installBundledPackage(pkgPath, packagesDir string, stores store.Stores, run
// Sync permissions — use a minimal gin.Context for the functions that need it
fakeCtx := newBackgroundGinContext()
SyncManifestPermissions(fakeCtx, stores, pkgID, manifest)
declaredPerms := SyncManifestPermissions(fakeCtx, stores, pkgID, manifest)
// Bundled packages are trusted — auto-grant all declared permissions
// and restore active status (SyncManifestPermissions sets pending_review).
// Use direct SQL with NULL granted_by to satisfy FK constraint on users(id).
if len(declaredPerms) > 0 {
now := time.Now().UTC().Format(time.RFC3339)
_, err := database.DB.ExecContext(ctx,
`UPDATE extension_permissions SET granted = 1, granted_by = NULL, granted_at = ? WHERE package_id = ? AND granted = 0`,
now, pkgID)
if err != nil {
log.Printf("[bundled] Failed to auto-grant permissions for %s: %v", pkgID, err)
}
_ = stores.Packages.SetStatus(ctx, pkgID, "active")
}
// Sync triggers from manifest
SyncManifestTriggers(ctx, stores, triggers.GlobalEngine(), pkgID, manifest)