源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
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
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
This commit is contained in:
commit
2ed3415fb7
8018 files changed
+1936476
No files matched your search
@@ -0,0 +1,97 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
agentactivitybiz "github.com/tutti-os/tutti/packages/agent/store-sqlite"
|
||||
"github.com/tutti-os/tutti/packages/agent/store-sqlite/canonical"
|
||||
tuttigenerated "github.com/tutti-os/tutti/services/tuttid/api/generated"
|
||||
)
|
||||
|
||||
func generatedAgentSessionCapabilities(snapshot *canonical.CapabilitySnapshot) *tuttigenerated.WorkspaceAgentCapabilities {
|
||||
if snapshot == nil {
|
||||
return nil
|
||||
}
|
||||
capabilities := generatedAgentCapabilities(snapshot.Values)
|
||||
return &capabilities
|
||||
}
|
||||
|
||||
func generatedAgentCapabilities(raw []string) tuttigenerated.WorkspaceAgentCapabilities {
|
||||
capabilities := tuttigenerated.WorkspaceAgentCapabilities{}
|
||||
for _, capability := range raw {
|
||||
switch strings.TrimSpace(capability) {
|
||||
case "browserUse":
|
||||
capabilities.BrowserUse = true
|
||||
case "compact":
|
||||
capabilities.Compact = true
|
||||
case "computerUse":
|
||||
capabilities.ComputerUse = true
|
||||
case "goalPause":
|
||||
capabilities.GoalPause = true
|
||||
case "imageInput":
|
||||
capabilities.ImageInput = true
|
||||
case "modelImageInputRequired":
|
||||
capabilities.ModelImageInputRequired = true
|
||||
case "interrupt":
|
||||
capabilities.Interrupt = true
|
||||
case "activeTurnGuidance":
|
||||
capabilities.ActiveTurnGuidance = true
|
||||
case "permissionModeChangeDeferred":
|
||||
capabilities.PermissionModeChangeDeferred = true
|
||||
case "permissionModeChangeDuringTurn":
|
||||
capabilities.PermissionModeChangeDuringTurn = true
|
||||
case "planImplementation":
|
||||
capabilities.PlanImplementation = true
|
||||
case "planMode":
|
||||
capabilities.PlanMode = true
|
||||
case "rateLimits":
|
||||
capabilities.RateLimits = true
|
||||
case "resumeRunningTurn":
|
||||
capabilities.ResumeRunningTurn = true
|
||||
case "review":
|
||||
capabilities.Review = true
|
||||
case "skills":
|
||||
capabilities.Skills = true
|
||||
case "tokenUsage":
|
||||
capabilities.TokenUsage = true
|
||||
}
|
||||
}
|
||||
return capabilities
|
||||
}
|
||||
|
||||
func generatedAgentSessionUsage(raw *agentactivitybiz.SessionUsage) *tuttigenerated.WorkspaceAgentUsage {
|
||||
var result tuttigenerated.WorkspaceAgentUsage
|
||||
if !decodeTypedAgentSessionField(raw, &result) {
|
||||
return nil
|
||||
}
|
||||
if result.ContextWindow == nil && len(result.Quotas) == 0 {
|
||||
return nil
|
||||
}
|
||||
if result.ContextWindow != nil && (result.ContextWindow.UsedTokens < 0 || result.ContextWindow.TotalTokens <= 0) {
|
||||
return nil
|
||||
}
|
||||
if result.Quotas == nil {
|
||||
result.Quotas = []tuttigenerated.WorkspaceAgentUsageQuota{}
|
||||
}
|
||||
return &result
|
||||
}
|
||||
|
||||
func generatedAgentSessionGoal(raw *agentactivitybiz.SessionGoal) *tuttigenerated.WorkspaceAgentSessionGoal {
|
||||
var result tuttigenerated.WorkspaceAgentSessionGoal
|
||||
if !decodeTypedAgentSessionField(raw, &result) || strings.TrimSpace(result.Objective) == "" || !result.Status.Valid() {
|
||||
return nil
|
||||
}
|
||||
return &result
|
||||
}
|
||||
|
||||
func decodeTypedAgentSessionField(raw any, target any) bool {
|
||||
if raw == nil {
|
||||
return false
|
||||
}
|
||||
data, err := json.Marshal(raw)
|
||||
if err != nil || json.Unmarshal(data, target) != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
Reference in new issue
Block a user