snapshotRuntimeOpts wires the snapshot builtin into a runtime. Returns the [runtime.Opt]s that hand the registry and the [builtins.SnapshotController] auto-injector to the runtime, plus the controller itself for the embedder to pass to the App via [app.WithSnapshotController]. When snapshots aren't
()
| 775 | // so the spawner-created sub-runtimes get their own snapshot state |
| 776 | // (each spawned session has independent /undo history). |
| 777 | func (f *runExecFlags) snapshotRuntimeOpts() ([]runtime.Opt, builtins.SnapshotController, error) { |
| 778 | if !f.snapshotsEnabled { |
| 779 | return nil, nil, nil |
| 780 | } |
| 781 | reg := hooks.NewRegistry() |
| 782 | ctrl, err := builtins.RegisterSnapshot(reg, true) |
| 783 | if err != nil { |
| 784 | return nil, nil, fmt.Errorf("register snapshot builtin: %w", err) |
| 785 | } |
| 786 | return []runtime.Opt{ |
| 787 | runtime.WithHooksRegistry(reg), |
| 788 | runtime.WithAutoInjector(ctrl), |
| 789 | }, ctrl, nil |
| 790 | } |
| 791 | |
| 792 | func (f *runExecFlags) createLocalRuntimeAndSession(ctx context.Context, loadResult *teamloader.LoadResult, req runtime.CreateSessionRequest, sessStore session.Store) (runtime.Runtime, *session.Session, error) { |
| 793 | t := loadResult.Team |
no test coverage detected