Documentation
¶
Overview ¶
Package opencodeinstall owns the explicit OpenCode notification lifecycle.
Index ¶
- Constants
- func Apply(ctx context.Context, r Request) error
- func ChannelsFromSnapshot(s installruntime.PolicySnapshot, executable, goos, goarch string) (bool, bool)
- func PrepareNativeSpool(ctx context.Context, controlRoot string) (string, error)
- func PrepareNativeSpoolFor(ctx context.Context, controlRoot string, product DesktopProduct) (string, error)
- func RegisteredFromSnapshot(s installruntime.PolicySnapshot, executable, goos, goarch string) bool
- func RevokeChannels(ctx context.Context, controlRoot, runtimeRoot string) error
- func SetupPermission(ctx context.Context, controlRoot string, request bool) (string, error)
- func StageWindowsShortcut(DesktopProduct, string, string, bool, installruntime.Ledger) (*installruntime.File, error)
- func WindowsShortcutReadyFor(DesktopProduct, string, string) error
- type Action
- type BundleRenderer
- type CurrentGate
- type DesktopProduct
- type NativeInstallation
- type RegistrationLease
- type Request
Constants ¶
const ( OpenCodeDesktop DesktopProduct = iota + 1 GeminiDesktop CopilotVSCodeDesktop OpenCodeToastAppID = "Genius.AgentNotifications.OpenCode" GeminiToastAppID = "Genius.AgentNotifications.Gemini" CopilotVSCodeToastAppID = "Genius.AgentNotifications.CopilotVSCode" GeminiConsumerID = "gemini-notifications" )
Variables ¶
This section is empty.
Functions ¶
func ChannelsFromSnapshot ¶
func ChannelsFromSnapshot(s installruntime.PolicySnapshot, executable, goos, goarch string) (bool, bool)
ChannelsFromSnapshot validates OpenCode ownership and explicit consent in an already-read policy snapshot. It is safe to use inside a setup/native lease callback after the caller revalidates that snapshot under the component lock.
func PrepareNativeSpool ¶
PrepareNativeSpool owns a separate OpenCode-only private namespace. Portable setup may later initialize controlRoot/state without colliding with it. Keep the spool on remove so a previously admitted bounded callback can complete.
func PrepareNativeSpoolFor ¶ added in v1.47.0
func PrepareNativeSpoolFor(ctx context.Context, controlRoot string, product DesktopProduct) (string, error)
PrepareNativeSpoolFor shares only the no-follow private-directory preparation. Each trusted observer retains its own namespace and permanent spool lock.
func RegisteredFromSnapshot ¶
func RegisteredFromSnapshot(s installruntime.PolicySnapshot, executable, goos, goarch string) bool
RegisteredFromSnapshot checks the owned OpenCode command without requiring desktop consent, so explicit permission setup can precede channel enablement.
func RevokeChannels ¶
RevokeChannels turns off only OpenCode's two channel consents. It is the first removal step and remains available when a delivery asset is missing or damaged; cleanup may report its own conflict afterward.
func SetupPermission ¶
SetupPermission is an explicit OpenCode setup operation. Registration and trusted native evidence are checked before the helper may probe or request OS authorization. No event handler calls this function.
func StageWindowsShortcut ¶ added in v1.47.0
func StageWindowsShortcut(DesktopProduct, string, string, bool, installruntime.Ledger) (*installruntime.File, error)
func WindowsShortcutReadyFor ¶ added in v1.47.0
func WindowsShortcutReadyFor(DesktopProduct, string, string) error
Types ¶
type BundleRenderer ¶ added in v1.48.0
type BundleRenderer interface {
RenderRegistration(executable, controlRoot, origin string) ([]byte, error)
}
BundleRenderer is the setup-only E2 port for the third fixed origin token. A nil renderer keeps legacy placement usable, without admitting its frames.
type CurrentGate ¶
type CurrentGate struct{ ControlRoot, Executable, GOOS, GOARCH string }
CurrentGate reads the product registration on each event. No recovery or config mutation occurs on this observation path.
type DesktopProduct ¶ added in v1.47.0
type DesktopProduct uint8
DesktopProduct selects an installer-owned observer identity. Config and native event data cannot supply an AUMID, shortcut or namespace.
type NativeInstallation ¶
type NativeInstallation struct {
ControlRoot string
Expected installruntime.PolicySnapshot
Executable string
GOOS, GOARCH string
}
NativeInstallation is bound to one event's policy snapshot. Its lease checks OpenCode registration and desktop consent independently of portable enablement while holding both managed locks through native handoff.
func (NativeInstallation) Acquire ¶
func (n NativeInstallation) Acquire(ctx context.Context) (notifier.NativeLease, error)
type RegistrationLease ¶ added in v1.48.0
type RegistrationLease struct {
// contains filtered or unexported fields
}
RegistrationLease can only be constructed by exact kernel lease validation. Native references retain the same fence; there is no reacquisition or bypass.
func AcquireRegistration ¶ added in v1.48.0
func AcquireRegistration(ctx context.Context, root string, expected installruntime.PolicySnapshot, executable, goos, goarch, origin string) (*RegistrationLease, error)
func (*RegistrationLease) Channels ¶ added in v1.48.0
func (l *RegistrationLease) Channels() (bool, bool)
func (*RegistrationLease) Close ¶ added in v1.48.0
func (l *RegistrationLease) Close()
func (*RegistrationLease) NativeInstallation ¶ added in v1.48.0
func (l *RegistrationLease) NativeInstallation(ctx context.Context) notifier.NativeInstallation
LeasedNativeInstallation consumes only the already validated registration lease. StructuredDelivery retains its manifest/probe/spool validation normally.
func (*RegistrationLease) Registration ¶ added in v1.48.0
func (l *RegistrationLease) Registration() installruntime.OpenCodeRegistration
type Request ¶
type Request struct {
Renderer BundleRenderer
Action Action
ControlRoot, RuntimeRoot, BinarySource string
NativeSource string
HomeDir, XDGConfigHome, OpenCodeConfigDir string
Desktop, Webhook bool
// Platform is supplied by the CLI. Tests use disposable platform fixtures.
GOOS, GOARCH string
}