跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

events.go

75 行 · 2.1 KB历史下载
1// SPDX-FileCopyrightText: Copyright The Lima Authors
2// SPDX-License-Identifier: Apache-2.0
3
4package events
5
6import (
7 "time"
8)
9
10type Status struct {
11 Running bool `json:"running,omitempty"`
12 // When Degraded is true, Running must be true as well
13 Degraded bool `json:"degraded,omitempty"`
14 // When Exiting is true, Running must be false
15 Exiting bool `json:"exiting,omitempty"`
16
17 Errors []string `json:"errors,omitempty"`
18
19 SSHLocalPort int `json:"sshLocalPort,omitempty"`
20
21 // Cloud-init progress information
22 CloudInitProgress *CloudInitProgress `json:"cloudInitProgress,omitempty"`
23
24 // Port forwarding event
25 PortForward *PortForwardEvent `json:"portForward,omitempty"`
26
27 // Vsock forwarder event
28 Vsock *VsockEvent `json:"vsock,omitempty"`
29}
30
31type CloudInitProgress struct {
32 // Current log line from cloud-init
33 LogLine string `json:"logLine,omitempty"`
34 // Whether cloud-init has completed
35 Completed bool `json:"completed,omitempty"`
36 // Whether cloud-init monitoring is active
37 Active bool `json:"active,omitempty"`
38}
39
40type PortForwardEventType string
41
42const (
43 PortForwardEventForwarding PortForwardEventType = "forwarding"
44 PortForwardEventNotForwarding PortForwardEventType = "not-forwarding"
45 PortForwardEventStopping PortForwardEventType = "stopping"
46 PortForwardEventFailed PortForwardEventType = "failed"
47)
48
49type PortForwardEvent struct {
50 Type PortForwardEventType `json:"type"`
51 Protocol string `json:"protocol,omitempty"`
52 GuestAddr string `json:"guestAddr,omitempty"`
53 HostAddr string `json:"hostAddr,omitempty"`
54 Error string `json:"error,omitempty"`
55}
56
57type VsockEventType string
58
59const (
60 VsockEventStarted VsockEventType = "started"
61 VsockEventSkipped VsockEventType = "skipped"
62 VsockEventFailed VsockEventType = "failed"
63)
64
65type VsockEvent struct {
66 Type VsockEventType `json:"type"`
67 HostAddr string `json:"hostAddr,omitempty"`
68 VsockPort int `json:"vsockPort,omitempty"`
69 Reason string `json:"reason,omitempty"`
70}
71
72type Event struct {
73 Time time.Time `json:"time,omitempty"`
74 Status Status `json:"status,omitempty"`
75}