Start 启动 AGUI Interface
(ctx context.Context, os *asteros.AsterOS)
| 68 | |
| 69 | // Start 启动 AGUI Interface |
| 70 | func (i *AGUIInterface) Start(ctx context.Context, os *asteros.AsterOS) error { |
| 71 | i.os = os |
| 72 | |
| 73 | // 创建可取消的上下文 |
| 74 | ctx, cancel := context.WithCancel(ctx) |
| 75 | i.cancel = cancel |
| 76 | |
| 77 | // 连接到控制平面 |
| 78 | if err := i.connect(ctx); err != nil { |
| 79 | return fmt.Errorf("connect to control plane: %w", err) |
| 80 | } |
| 81 | |
| 82 | // 启动自动同步 |
| 83 | if i.opts.EnableAutoSync { |
| 84 | go i.syncLoop(ctx) |
| 85 | } |
| 86 | |
| 87 | if i.opts.EnableLogging { |
| 88 | fmt.Printf("✓ AGUI Interface started\n") |
| 89 | fmt.Printf(" → Control Plane: %s\n", i.opts.ControlPlaneURL) |
| 90 | } |
| 91 | |
| 92 | return nil |
| 93 | } |
| 94 | |
| 95 | // Stop 停止 AGUI Interface |
| 96 | func (i *AGUIInterface) Stop(ctx context.Context) error { |