MCPcopy Create free account
hub / github.com/compozy/agh / Run

Method Run

internal/cli/cli_integration_test.go:3572–3794  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

3570}
3571
3572func (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)

Callers 1

spawnDetachedMethod · 0.95

Calls 15

EnsureDirsMethod · 0.95
StartMethod · 0.95
StopMethod · 0.95
SetTurnEndNotifierMethod · 0.95
ListMethod · 0.95
ShutdownMethod · 0.95
OpenGlobalDBFunction · 0.92
NewManagerFunction · 0.92
WithHomePathsFunction · 0.92
WithWorkspaceResolverFunction · 0.92

Tested by

no test coverage detected