返回 DeepSeek-Reasonix
tab_meta.go
根目录 / desktop / tab_meta.go
1 package main
2
3 import (
4 "reasonix/internal/control"
5 "reasonix/internal/gitcmd"
6 goaldomain "reasonix/internal/goal"
7 "reasonix/internal/session"
8 )
9
10 // TabMeta is the frontend-facing shape of one tab.
11 type TabMeta struct {
12 ID string `json:"id"`
13 Scope string `json:"scope"`
14 WorkspaceRoot string `json:"workspaceRoot"`
15 WorkspaceID string `json:"workspaceId,omitempty"`
16 WorkspaceName string `json:"workspaceName"`
17 WorkspacePath string `json:"workspacePath,omitempty"`
18 GitBranch string `json:"gitBranch,omitempty"`
19 IsolatedWorktree bool `json:"isolatedWorktree,omitempty"`
20 Remote *RemoteTabRef `json:"remote,omitempty"`
21 // RemoteState seeds restored remote shells before their first state event.
22 RemoteState string `json:"remoteState,omitempty"`
23 // ForkTargetsSupported reports whether this tab can fork a turn into an
24 // independent child session. False for a local tab and for a remote serve
25 // before its handshake; always emitted, so absence never means "unsupported".
26 ForkTargetsSupported bool `json:"forkTargetsSupported"`
27 InteractionTargetSupported bool `json:"interactionTargetSupported"`
28 ExtensionFormInstanceSupported bool `json:"extensionFormInstanceSupported"`
29 TopicID string `json:"topicId"`
30 TopicTitle string `json:"topicTitle"`
31 SessionPath string `json:"sessionPath,omitempty"`
32 SessionID string `json:"sessionId,omitempty"`
33 Session *session.SessionRef `json:"session,omitempty"`
34 SessionRevision int64 `json:"sessionRevision,omitempty"`
35 SessionDigest string `json:"sessionDigest,omitempty"`
36 SessionGeneration uint64 `json:"sessionGeneration,omitempty"`
37 ReadOnly bool `json:"readOnly,omitempty"`
38 // TakenOver marks a local or remote tab spectating a session whose writer is
39 // on the other side of a cooperative handoff.
40 TakenOver bool `json:"takenOver,omitempty"`
41 ProjectColor string `json:"projectColor,omitempty"`
42 Label string `json:"label"`
43 Ready bool `json:"ready"`
44 Runtime SessionRuntimeView `json:"runtime"`
45 Running bool `json:"running"`
46 TurnStartedAt int64 `json:"turnStartedAt,omitempty"`
47 PendingPrompt bool `json:"pendingPrompt,omitempty"`
48 RemoteControlled bool `json:"remoteControlled,omitempty"`
49 BackgroundJobs int `json:"backgroundJobs,omitempty"`
50 CancelRequested bool `json:"cancelRequested,omitempty"`
51 Cancellable bool `json:"cancellable"`
52 TurnID string `json:"turnId,omitempty"`
53 TurnStatus string `json:"turnStatus,omitempty"`
54 TurnEventSeq uint64 `json:"turnEventSeq,omitempty"`
55 TurnReplayAfter uint64 `json:"turnReplayAfterSeq,omitempty"`
56 Mode string `json:"mode"`
57 CollaborationMode string `json:"collaborationMode"`
58 ToolApprovalMode string `json:"toolApprovalMode"`
59 TokenMode string `json:"tokenMode"`
60 AgentPreset string `json:"agentPreset,omitempty"`
61 QualityFloor string `json:"qualityFloor,omitempty"`
62 FloorInferred bool `json:"floorInferred,omitempty"`
63 Goal string `json:"goal,omitempty"`
64 GoalStatus string `json:"goalStatus,omitempty"`
65 GoalView *goaldomain.View `json:"goalView,omitempty"`
66 Recovered bool `json:"recovered,omitempty"`
67 RecoveryReason string `json:"recoveryReason,omitempty"`
68 RecoveryDigest string `json:"recoveryDigest,omitempty"`
69 RecoveryParentID string `json:"recoveryParentId,omitempty"`
70 VersionKind string `json:"versionKind,omitempty"`
71 VersionState string `json:"versionState,omitempty"`
72 ParentVersionID string `json:"parentVersionId,omitempty"`
73 StartupErr string `json:"startupErr,omitempty"`
74 HistoricalSource *SessionSourceRef `json:"historicalSource,omitempty"`
75 Authentication *control.AuthenticationState `json:"authentication,omitempty"`
76 ModelSettingsPending bool `json:"modelSettingsPending,omitempty"`
77 Active bool `json:"active"`
78 Cwd string `json:"cwd"`
79 // repo is the tab session's git identity for WorkspaceRoot; never serialized.
80 repo gitcmd.Repo
81 }
82
83 // setAuthenticationMeta only exposes pending settings belonging to this runtime.
84 // A replacement controller must never inherit an older generation's hint.
85 func (m *TabMeta) setAuthenticationMeta(tab *WorkspaceTab) {
86 if auth, ok := tab.Ctrl.(interface {
87 AuthenticationState() control.AuthenticationState
88 }); ok {
89 state := auth.AuthenticationState()
90 m.Authentication = &state
91 }
92 if extras := tab.metaExtras.Load(); extras != nil && extras.controller == tab.Ctrl {
93 m.ModelSettingsPending = extras.modelSettingsPending
94 }
95 }
96
96 lines GO