cloneProviderOptions returns a copy of opts with pointer entries for known, in-place mutated provider option types replaced by a shallow struct copy. chatloop mutates the OpenAI Responses entry (PreviousResponseID) on chain-mode exit, so sharing the pointer with the parent run would let an advisor c
(opts fantasy.ProviderOptions)
| 70 | // package mutates them, but callers that need true deep-copy semantics must |
| 71 | // handle those fields explicitly. |
| 72 | func cloneProviderOptions(opts fantasy.ProviderOptions) fantasy.ProviderOptions { |
| 73 | if opts == nil { |
| 74 | return nil |
| 75 | } |
| 76 | cloned := make(fantasy.ProviderOptions, len(opts)) |
| 77 | for key, value := range opts { |
| 78 | switch typed := value.(type) { |
| 79 | case *fantasyopenai.ResponsesProviderOptions: |
| 80 | if typed == nil { |
| 81 | cloned[key] = value |
| 82 | continue |
| 83 | } |
| 84 | copied := *typed |
| 85 | cloned[key] = &copied |
| 86 | default: |
| 87 | cloned[key] = value |
| 88 | } |
| 89 | } |
| 90 | return cloned |
| 91 | } |
| 92 | |
| 93 | // resetProviderOptionsForNestedCall strips inherited state from opts that |
| 94 | // does not apply to an ephemeral advisor call. PreviousResponseID is |
no outgoing calls
no test coverage detected