| 132 | // Returns the new turnId, or null if the input was buffered as a steer |
| 133 | // message or the turn was marked as resuming. |
| 134 | steer(input: readonly ContentPart[], origin: PromptOrigin = USER_PROMPT_ORIGIN): number | null { |
| 135 | this.agent.records.logRecord({ |
| 136 | type: 'turn.steer', |
| 137 | input, |
| 138 | origin, |
| 139 | }); |
| 140 | // Buffer while a turn is active OR a manual compaction holds the context; |
| 141 | // `onCompactionFinished` replays the buffer once compaction's full lifecycle |
| 142 | // (summary + reinjection) is done. Returning null means "buffered" — which is |
| 143 | // exactly what fire-and-forget callers (background notifications, cron) assume. |
| 144 | if (this.activeTurn || this.agent.fullCompaction.isCompacting) { |
| 145 | this.steerBuffer.push({ input, origin }); |
| 146 | return null; |
| 147 | } |
| 148 | return this.launch(input, origin); |
| 149 | } |
| 150 | |
| 151 | retry(trigger?: string): number | null { |
| 152 | return this.prompt([], { kind: 'retry', trigger }); |