| 102 | } |
| 103 | |
| 104 | private _cloneImpl(): MockAgent { |
| 105 | const cloned = new MockAgent({ |
| 106 | messages: [...this.messages], |
| 107 | newMessages: [...this.newMessages], |
| 108 | error: this.error, |
| 109 | runAgentDelay: this.runAgentDelay, |
| 110 | runAgentCallback: this.runAgentCallback, |
| 111 | agentId: this.agentId, |
| 112 | threadId: this.threadId, |
| 113 | state: JSON.parse(JSON.stringify(this.state)), |
| 114 | }); |
| 115 | // Link the clone back to the parent so calls are visible |
| 116 | cloned._parentAgent = this; |
| 117 | return cloned; |
| 118 | } |
| 119 | |
| 120 | // Provide a no-op subscribe API so core can attach state listeners |
| 121 | // without errors during tests. |