(agentScope, name, path, content string, turnCount int)
| 40 | } |
| 41 | |
| 42 | func (p *SkillPersistence) RecordInvocation(agentScope, name, path, content string, turnCount int) { |
| 43 | if p == nil || content == "" { |
| 44 | return |
| 45 | } |
| 46 | if agentScope == "" { |
| 47 | agentScope = "main" |
| 48 | } |
| 49 | p.mu.Lock() |
| 50 | defer p.mu.Unlock() |
| 51 | scopeRecords := p.records[agentScope] |
| 52 | if scopeRecords == nil { |
| 53 | scopeRecords = map[string]InvokedSkillRecord{} |
| 54 | p.records[agentScope] = scopeRecords |
| 55 | } |
| 56 | now := float64(time.Now().UnixNano()) / float64(time.Second) |
| 57 | record, exists := scopeRecords[name] |
| 58 | if !exists { |
| 59 | scopeRecords[name] = InvokedSkillRecord{ |
| 60 | Name: name, |
| 61 | Path: path, |
| 62 | Content: content, |
| 63 | InvokedAt: now, |
| 64 | AgentScope: agentScope, |
| 65 | LastTurnIndex: turnCount, |
| 66 | InvocationCount: 1, |
| 67 | } |
| 68 | p.order[agentScope] = append(p.order[agentScope], name) |
| 69 | return |
| 70 | } |
| 71 | record.Path = path |
| 72 | record.Content = content |
| 73 | record.InvokedAt = now |
| 74 | record.LastTurnIndex = turnCount |
| 75 | record.InvocationCount++ |
| 76 | scopeRecords[name] = record |
| 77 | } |
| 78 | |
| 79 | func (p *SkillPersistence) BuildRecoveryAttachment(agentScope string) *string { |
| 80 | if p == nil { |
no outgoing calls