Fire SessionStart once per instance, stashing any injected context for * the first user message.
()
| 418 | /** Fire SessionStart once per instance, stashing any injected context for |
| 419 | * the first user message. */ |
| 420 | private async maybeFireSessionStart(): Promise<void> { |
| 421 | if (this.sessionStarted) return |
| 422 | this.sessionStarted = true |
| 423 | if (!this.hooks.hasHooks("SessionStart")) return |
| 424 | const result = await this.hooks.run("SessionStart", { |
| 425 | source: this.options.resume ? "resume" : "startup", |
| 426 | }) |
| 427 | if (result.additionalContext) this.pendingStartContext = result.additionalContext |
| 428 | } |
| 429 | |
| 430 | /** Ask Stop hooks whether the turn should keep going. Forces at most one |
| 431 | * continuation per turn (stop_hook_active) so a hook can't loop forever. */ |