api/pkg/provider/provider.go
Claude ca9b495884
chore: migrate to dappco.re vanity import path
Change module path from forge.lthn.ai/core/api to dappco.re/go/core/api.
Update all Go imports accordingly:
- forge.lthn.ai/core/api -> dappco.re/go/core/api
- forge.lthn.ai/core/go-io -> dappco.re/go/core/io
- forge.lthn.ai/core/go-log -> dappco.re/go/core/log

forge.lthn.ai/core/cli left as-is (not yet migrated).
Local replace directives added for dappco.re paths until vanity
URL server is configured.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 23:50:37 +00:00

52 lines
1.7 KiB
Go

// SPDX-Licence-Identifier: EUPL-1.2
// Package provider defines the Service Provider Framework interfaces.
//
// A Provider extends api.RouteGroup with a provider identity. Providers
// register through the existing api.Engine.Register() method, inheriting
// middleware, CORS, Swagger, and OpenAPI generation automatically.
//
// Optional interfaces (Streamable, Describable, Renderable) declare
// additional capabilities that consumers (GUI, MCP, WS hub) can discover
// via type assertion.
package provider
import (
"dappco.re/go/core/api"
)
// Provider extends RouteGroup with a provider identity.
// Every Provider is a RouteGroup and registers through api.Engine.Register().
type Provider interface {
api.RouteGroup // Name(), BasePath(), RegisterRoutes(*gin.RouterGroup)
}
// Streamable providers emit real-time events via WebSocket.
// The hub is injected at construction time. Channels() declares the
// event prefixes this provider will emit (e.g. "brain.*", "process.*").
type Streamable interface {
Provider
Channels() []string
}
// Describable providers expose structured route descriptions for OpenAPI.
// This extends the existing DescribableGroup interface from go-api.
type Describable interface {
Provider
api.DescribableGroup // Describe() []RouteDescription
}
// Renderable providers declare a custom element for GUI display.
type Renderable interface {
Provider
Element() ElementSpec
}
// ElementSpec describes a web component for GUI rendering.
type ElementSpec struct {
// Tag is the custom element tag name, e.g. "core-brain-panel".
Tag string `json:"tag"`
// Source is the URL or embedded path to the JS bundle.
Source string `json:"source"`
}