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
74 lines
2.9 KiB
Go
74 lines
2.9 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
|
|
agentservice "github.com/tutti-os/tutti/services/tuttid/service/agent"
|
|
agentextensionservice "github.com/tutti-os/tutti/services/tuttid/service/agentextension"
|
|
)
|
|
|
|
type agentExtensionComposerProfileResolver struct {
|
|
manager *agentextensionservice.Manager
|
|
}
|
|
|
|
func (r agentExtensionComposerProfileResolver) ResolveExtensionComposerProfile(
|
|
_ context.Context,
|
|
installationID string,
|
|
) (agentservice.ExtensionComposerProfile, error) {
|
|
profile, err := r.manager.LoadComposerProfile(installationID)
|
|
if err != nil {
|
|
return agentservice.ExtensionComposerProfile{}, err
|
|
}
|
|
capabilities, err := r.manager.LoadDeclaredCapabilities(installationID)
|
|
if err != nil {
|
|
return agentservice.ExtensionComposerProfile{}, err
|
|
}
|
|
result := agentservice.ExtensionComposerProfile{
|
|
Capabilities: capabilities,
|
|
PermissionModeIDPolicy: agentservice.ExtensionPermissionModeIDPolicyRuntime,
|
|
RuntimePrep: profile.RuntimePrep,
|
|
}
|
|
result.ModelConfigOptionID, result.PermissionConfigOptionID, result.ReasoningConfigOptionID = profile.ACPConfigOptionIDs()
|
|
if launchPermission := profile.LaunchPermissionSetting(); launchPermission != nil {
|
|
result.DefaultPermissionModeID = launchPermission.DefaultSemantic
|
|
result.PermissionModeIDPolicy = agentservice.ExtensionPermissionModeIDPolicySemantic
|
|
if result.DefaultPermissionModeID == "" {
|
|
result.DefaultPermissionModeID = "ask-before-write"
|
|
}
|
|
}
|
|
result.PermissionModes = make([]agentservice.ExtensionComposerPermissionMode, 0, len(profile.PermissionModes))
|
|
for _, mode := range profile.PermissionModes {
|
|
result.PermissionModes = append(result.PermissionModes, agentservice.ExtensionComposerPermissionMode{
|
|
RuntimeID: strings.TrimSpace(mode.RuntimeID),
|
|
Semantic: agentservice.PermissionModeSemantic(strings.TrimSpace(mode.Semantic)),
|
|
})
|
|
}
|
|
if profile.Skills != nil {
|
|
roots := make([]agentservice.ExtensionComposerSkillRoot, 0, len(profile.Skills.Roots))
|
|
for _, root := range profile.Skills.Roots {
|
|
roots = append(roots, agentservice.ExtensionComposerSkillRoot{
|
|
Scope: root.Scope,
|
|
Path: root.Path,
|
|
})
|
|
}
|
|
result.Skills = &agentservice.ExtensionComposerSkillProfile{
|
|
Invocation: profile.Skills.Invocation,
|
|
TriggerPrefix: profile.Skills.TriggerPrefix,
|
|
RuntimeCommandProjection: profile.Skills.RuntimeCommandProjection,
|
|
Roots: roots,
|
|
}
|
|
}
|
|
if profile.SlashCommands != nil {
|
|
result.SlashCommandCatalogAuthoritative = profile.SlashCommands.CommandCatalogAuthoritative
|
|
result.SlashCommands = make([]agentservice.ExtensionComposerSlashCommand, 0, len(profile.SlashCommands.Commands))
|
|
for _, command := range profile.SlashCommands.Commands {
|
|
result.SlashCommands = append(result.SlashCommands, agentservice.ExtensionComposerSlashCommand{
|
|
Name: command.Name,
|
|
Effect: command.Effect,
|
|
})
|
|
}
|
|
}
|
|
return result, nil
|
|
}
|