Feat v0.10.0 panel manifest lifecycle
Panels are a new kernel rendering tier between surfaces and block renderers, enabling composable companion views (e.g. notes panel inside chat). This version ships the plumbing layer: - Manifest validation for panels field (provider map + consumer array) - Soft-dep warning at install time for unresolved panel consumers - PanelMeta struct + resolvePanels() resolves consumers at surface load - window.__PANELS__ injected into base template - sw.panels SDK module (open/close/toggle/isOpen/isAvailable/list/active) - Lazy JS loading pipeline with module caching - 10 new tests (6 validation + 4 resolve) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,8 @@ type ManifestInfo struct {
|
||||
RequiresRoles []string // team roles needed to access this package (advisory, OR semantics)
|
||||
Adoptable bool // if true, teams can adopt this package to get a team-scoped copy
|
||||
HasFormTemplate bool // if true, package declares a form_template at the top level
|
||||
HasPanels bool // if true, package provides panels (provider form)
|
||||
PanelConsumers []string // panel IDs this package consumes (consumer form, e.g. "notes.reference")
|
||||
}
|
||||
|
||||
// ValidateManifest parses a manifest map and validates all required fields,
|
||||
@@ -199,6 +201,44 @@ func ValidateManifest(manifest map[string]any) (*ManifestInfo, error) {
|
||||
info.HasFormTemplate = true
|
||||
}
|
||||
|
||||
// v0.10.0: panels — provider (map) or consumer (array) declarations
|
||||
if rawPanels := manifest["panels"]; rawPanels != nil {
|
||||
switch p := rawPanels.(type) {
|
||||
case map[string]any:
|
||||
// Provider form: { "reference": { "entry": "...", "title": "..." }, ... }
|
||||
for key, raw := range p {
|
||||
panel, ok := raw.(map[string]any)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("panels.%s must be an object", key)
|
||||
}
|
||||
entry, _ := panel["entry"].(string)
|
||||
if entry == "" {
|
||||
return nil, fmt.Errorf("panels.%s requires an 'entry' field", key)
|
||||
}
|
||||
title, _ := panel["title"].(string)
|
||||
if title == "" {
|
||||
return nil, fmt.Errorf("panels.%s requires a 'title' field", key)
|
||||
}
|
||||
}
|
||||
info.HasPanels = true
|
||||
case []any:
|
||||
// Consumer form: ["notes.reference", "notes.graph"]
|
||||
for i, raw := range p {
|
||||
s, ok := raw.(string)
|
||||
if !ok || s == "" {
|
||||
return nil, fmt.Errorf("panels[%d] must be a non-empty string", i)
|
||||
}
|
||||
parts := strings.SplitN(s, ".", 2)
|
||||
if len(parts) != 2 || parts[0] == "" || parts[1] == "" {
|
||||
return nil, fmt.Errorf("panels[%d] must be in 'package.panel' format, got %q", i, s)
|
||||
}
|
||||
info.PanelConsumers = append(info.PanelConsumers, s)
|
||||
}
|
||||
default:
|
||||
return nil, fmt.Errorf("panels must be an object (provider) or array (consumer)")
|
||||
}
|
||||
}
|
||||
|
||||
info.SchemaVersion = ParseSchemaVersion(manifest)
|
||||
|
||||
// ── Type-specific constraints ────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user