( ctx context.Context, scope toolspkg.Scope, req toolspkg.CallRequest, )
| 5313 | } |
| 5314 | |
| 5315 | func (n *daemonNativeTools) memoryCallerActorKind( |
| 5316 | ctx context.Context, |
| 5317 | scope toolspkg.Scope, |
| 5318 | req toolspkg.CallRequest, |
| 5319 | ) (nativeMemoryActorKind, error) { |
| 5320 | if actorKind := normalizeNativeMemoryActorKind(firstNonEmpty(req.ActorKind, scope.ActorKind)); actorKind != "" { |
| 5321 | return actorKind, nil |
| 5322 | } |
| 5323 | sessionID := strings.TrimSpace(firstNonEmpty(req.SessionID, scope.SessionID)) |
| 5324 | if sessionID == "" || n == nil || n.deps == nil || n.deps.Sessions == nil { |
| 5325 | return nativeMemoryActorKind(""), nil |
| 5326 | } |
| 5327 | info, err := n.deps.Sessions.Status(ctx, sessionID) |
| 5328 | if err != nil { |
| 5329 | return nativeMemoryActorKind(""), fmt.Errorf( |
| 5330 | "daemon: resolve memory tool caller session %q: %w", |
| 5331 | sessionID, |
| 5332 | err, |
| 5333 | ) |
| 5334 | } |
| 5335 | if info != nil && info.Lineage != nil && strings.TrimSpace(info.Lineage.ParentSessionID) != "" { |
| 5336 | return nativeMemoryActorKindSubagent, nil |
| 5337 | } |
| 5338 | return nativeMemoryActorKindRoot, nil |
| 5339 | } |
| 5340 | |
| 5341 | func (n *daemonNativeTools) denySubagentMemoryWrite( |
| 5342 | ctx context.Context, |
no test coverage detected