Files
CLIProxyAPI/internal/homeplugins/local_executor.go
hkfires 6acc778c0f feat(home): add local plugin executor dispatch
Authorize acp/ models via Home local-plugin-dispatch and run
the selected plugin executor without upstream credentials.
Validate plugin version, config digest, host/Home fences, and
the authorized model across execute, stream, and count paths,
while falling back to credential dispatch for legacy Home.

Preserve before-auth interception, usage attribution, payload
finalization, and router exclusions for delegated requests.
Expose static executor models and avoid reusing resident
shadow plugin images on reload.
2026-11-26 19:16:36 +08:00

28 lines
628 B
Go

package homeplugins
import "context"
const ACPModelPrefix = "acp/"
type LocalExecutorGrant struct {
Plugin string
Version string
ConfigDigest string
Model string
Valid func() bool
}
type localExecutorGrantKey struct{}
func WithLocalExecutorGrant(ctx context.Context, grant LocalExecutorGrant) context.Context {
return context.WithValue(ctx, localExecutorGrantKey{}, grant)
}
func ExecutorGrant(ctx context.Context) (LocalExecutorGrant, bool) {
if ctx == nil {
return LocalExecutorGrant{}, false
}
grant, ok := ctx.Value(localExecutorGrantKey{}).(LocalExecutorGrant)
return grant, ok
}