(ctx context.Context)
| 3570 | } |
| 3571 | |
| 3572 | func (d *integrationDaemon) Run(ctx context.Context) error { |
| 3573 | registry, err := globaldb.OpenGlobalDB(context.Background(), d.homePaths.DatabaseFile) |
| 3574 | if err != nil { |
| 3575 | return fmt.Errorf("open global db: %w", err) |
| 3576 | } |
| 3577 | defer func() { |
| 3578 | _ = registry.Close(context.Background()) |
| 3579 | }() |
| 3580 | |
| 3581 | fanout := &integrationNotifierFanout{} |
| 3582 | resolver, err := workspacepkg.NewResolver( |
| 3583 | registry, |
| 3584 | workspacepkg.WithHomePaths(d.homePaths), |
| 3585 | workspacepkg.WithLogger(discardLogger()), |
| 3586 | workspacepkg.WithConfigLoader(func(string) (aghconfig.Config, error) { return d.cfg, nil }), |
| 3587 | ) |
| 3588 | if err != nil { |
| 3589 | return fmt.Errorf("new workspace resolver: %w", err) |
| 3590 | } |
| 3591 | sandboxRegistry, err := sandboxlocal.NewRegistry() |
| 3592 | if err != nil { |
| 3593 | return fmt.Errorf("new local sandbox registry: %w", err) |
| 3594 | } |
| 3595 | manager, err := session.NewManager( |
| 3596 | session.WithHomePaths(d.homePaths), |
| 3597 | session.WithWorkspaceResolver(resolver), |
| 3598 | session.WithLogger(discardLogger()), |
| 3599 | session.WithDriver(func() *integrationDriver { |
| 3600 | driver := newIntegrationDriver() |
| 3601 | d.mu.Lock() |
| 3602 | d.driver = driver |
| 3603 | d.mu.Unlock() |
| 3604 | return driver |
| 3605 | }()), |
| 3606 | session.WithNotifier(fanout), |
| 3607 | session.WithSandboxRegistry(sandboxRegistry), |
| 3608 | session.WithSoulSnapshotStore(registry), |
| 3609 | session.WithSoulRunActivityChecker(integrationSoulRunActivityChecker{}), |
| 3610 | session.WithSessionHealthStore(registry), |
| 3611 | session.WithSessionHealthConfig(d.cfg.Agents.Heartbeat), |
| 3612 | ) |
| 3613 | if err != nil { |
| 3614 | return fmt.Errorf("new session manager: %w", err) |
| 3615 | } |
| 3616 | d.mu.Lock() |
| 3617 | d.manager = manager |
| 3618 | d.mu.Unlock() |
| 3619 | |
| 3620 | taskManager, err := taskpkg.NewManager( |
| 3621 | taskpkg.WithStore(registry), |
| 3622 | taskpkg.WithSessionExecutor(&integrationTaskExecutor{}), |
| 3623 | taskpkg.WithNetworkChannelValidator(network.ValidateChannel), |
| 3624 | ) |
| 3625 | if err != nil { |
| 3626 | return fmt.Errorf("new task manager: %w", err) |
| 3627 | } |
| 3628 | |
| 3629 | bridgeService := newIntegrationBridgeService(registry) |
no test coverage detected