feat(kit): central tools for harnesses through the egress proxy and gateway task-tool RPCs

This commit is contained in:
sam committed 2026-10-17 23:42:37 +11:00
1 parent f975dccec0
commit 3f553bb6f2
41 files changed
+2187 -189

No files matched your search

+2 -2
View File
@@ -1937,12 +1937,12 @@ func (d *Daemon) pinTaskProfile(ctx context.Context, task *workflow.Task) (confi
// validateProfileMeetsNeeds rejects a Kit profile whose harness cannot serve
// the captures the workflow needs. Image profiles always pass.
func validateProfileMeetsNeeds(profile config.AgentProfile, needs workflowtask.WorkflowNeeds) error {
if !profile.IsKit() || !needs.Captures {
if !profile.IsKit() || (!needs.Captures && len(profile.Tools) == 0) {
return nil
}
adapter, ok := agentexec.LookupHarnessAdapter(profile.Adapter)
if !ok || len(adapter.MCPConfig) == 0 {
return fmt.Errorf("needs.captures is set, but profile adapter %q serves no capture tools", profile.Adapter)
return fmt.Errorf("profile adapter %q cannot register the required Archie MCP tools", profile.Adapter)
}
return nil
}
+2 -2
View File
@@ -120,7 +120,7 @@ func (d *Daemon) removeEndedKitVolumes(ctx context.Context, taskID int64, volume
// through the egress proxy, which swaps in the org's bound key.
type ModelEgress interface {
Open(token, org string, providers map[string]config.Provider) (ModelSession, error)
Close(token string)
Close(ctx context.Context, token string)
}
// TaskModels answers what a task's org resolves models against.
@@ -174,5 +174,5 @@ func (d *Daemon) openModelEgress(ctx context.Context, task *workflow.Task, crede
if err != nil {
return ModelSession{}, nil, err
}
return session, func() { d.ModelEgress.Close(credential) }, nil
return session, func() { d.ModelEgress.Close(ctx, credential) }, nil
}
+2 -12
View File
@@ -2,7 +2,6 @@ package daemon
import (
"context"
"slices"
"github.com/samcharles93/archie-core/internal/domain/storepkg"
"github.com/samcharles93/archie-core/internal/domain/workflow"
@@ -21,10 +20,7 @@ type PackageAuthorities interface {
func (d *Daemon) toolAllowlist(ctx context.Context, task *workflow.Task, profileTools []string) []string {
name := workflow.PackageOf(task.WorkflowDefinitionYAML)
if name == "" {
if len(profileTools) == 0 {
return nil
}
return profileTools
return storepkg.AllowedTools(profileTools, false, nil)
}
var accepted []string
if d.PackageAuthorities != nil {
@@ -35,11 +31,5 @@ func (d *Daemon) toolAllowlist(ctx context.Context, task *workflow.Task, profile
accepted = authority.Tools
}
}
allowed := []string{}
for _, tool := range accepted {
if len(profileTools) == 0 || slices.Contains(profileTools, tool) {
allowed = append(allowed, tool)
}
}
return allowed
return storepkg.AllowedTools(profileTools, true, accepted)
}