Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
51 lines
1.6 KiB
Go
51 lines
1.6 KiB
Go
package runtime
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"strings"
|
|
|
|
connectorhost "github.com/tutti-os/tutti/packages/connector/daemon/core"
|
|
)
|
|
|
|
const (
|
|
ConnectorNodeProfile = "connector-node-static"
|
|
ConnectorPythonProfile = "connector-python-static"
|
|
)
|
|
|
|
// ConnectorRuntimeResolver resolves and re-verifies a managed runtime on the
|
|
// same machine where connector processes execute. Tutti supplies a local
|
|
// adapter; VM-backed hosts supply the adapter inside their guest runtime.
|
|
type ConnectorRuntimeResolver interface {
|
|
ResolveProfile(context.Context, string) (ResolvedConnectorRuntime, error)
|
|
VerifyLaunch(profile, runtimeName string) (ConnectorExecutable, error)
|
|
}
|
|
|
|
type ResolvedConnectorRuntime struct {
|
|
Root string
|
|
Profile string
|
|
ABI string
|
|
Node *ConnectorExecutable
|
|
Python *ConnectorExecutable
|
|
Components map[string]string
|
|
}
|
|
|
|
type ConnectorExecutable struct {
|
|
Path string
|
|
SHA256 string
|
|
SizeBytes int64
|
|
}
|
|
|
|
// VerifyRuntimeABI binds a connector's published runtime requirement to the
|
|
// locally resolved runtime before any connector-controlled entrypoint starts.
|
|
func VerifyRuntimeABI(requirement connectorhost.RuntimeRequirement, resolved ResolvedConnectorRuntime) error {
|
|
if requirement.Profile != resolved.Profile || requirement.ABI != resolved.ABI {
|
|
return errors.New("connector runtime ABI does not match the verified local runtime")
|
|
}
|
|
if requirement.Language == "node" && strings.TrimSpace(requirement.VersionRange) != "" &&
|
|
!nodeVersionSatisfies(resolved.Components["node"], requirement.VersionRange) {
|
|
return errors.New("connector Node version requirement does not match the verified local runtime")
|
|
}
|
|
return nil
|
|
}
|