@tilt-launcher/sdk 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts ADDED
@@ -0,0 +1,171 @@
1
+ export type ResourceKind = 'serve' | 'cmd' | 'unknown';
2
+
3
+ export interface CachedResource {
4
+ name: string;
5
+ label: string;
6
+ category?: string | undefined;
7
+ type?: string | undefined;
8
+ endpoint?: string | undefined;
9
+ port?: number | undefined;
10
+ path?: string | undefined;
11
+ runtimeStatus?: string | undefined;
12
+ isDisabled?: boolean | undefined;
13
+ resourceKind?: ResourceKind | undefined;
14
+ // New fields from UIResource status
15
+ updateStatus?: string | undefined;
16
+ waitingReason?: string | undefined;
17
+ waitingOn?: string[] | undefined;
18
+ lastDeployTime?: string | undefined;
19
+ lastBuildDuration?: number | undefined;
20
+ lastBuildError?: string | undefined;
21
+ hasPendingChanges?: boolean | undefined;
22
+ triggerMode?: number | undefined;
23
+ queued?: boolean | undefined;
24
+ order?: number | undefined;
25
+ pid?: number | undefined;
26
+ conditions?: Array<{ type: string; status: string; lastTransitionTime?: string }> | undefined;
27
+ }
28
+
29
+ export interface ServiceGroup {
30
+ id: string;
31
+ label: string;
32
+ resourceNames: string[];
33
+ }
34
+
35
+ export interface SubServiceMapping {
36
+ parentName: string;
37
+ childName: string;
38
+ }
39
+
40
+ export interface ServiceMapping {
41
+ groups: ServiceGroup[];
42
+ subServices: SubServiceMapping[];
43
+ labelOverrides: Record<string, string>;
44
+ resourceOrder: string[];
45
+ hiddenResources: string[];
46
+ }
47
+
48
+ export interface Environment {
49
+ id: string;
50
+ name: string;
51
+ /** True when this environment is an externally-managed Tilt process (port-only). */
52
+ external?: boolean | undefined;
53
+ repoDir: string;
54
+ tiltfile: string;
55
+ tiltPort: number;
56
+ description?: string | undefined;
57
+ isSymlink?: boolean | undefined;
58
+ selectedResources?: string[] | undefined;
59
+ cachedResources?: CachedResource[] | undefined;
60
+ serviceMapping?: ServiceMapping | undefined;
61
+ }
62
+
63
+ export interface PickedTiltfile {
64
+ path: string;
65
+ isSymlink: boolean;
66
+ /** Resolved real path (absolute) when isSymlink is true */
67
+ realPath?: string | undefined;
68
+ }
69
+
70
+ export interface Config {
71
+ themeMode?: 'dark' | 'light' | 'system' | undefined;
72
+ environments: Environment[];
73
+ }
74
+
75
+ export interface EnvStatus {
76
+ status: 'stopped' | 'starting' | 'running';
77
+ logs: string[];
78
+ resourceLogs?: Record<string, string[]> | undefined;
79
+ tiltPort: number;
80
+ uptime: number | null;
81
+ newResources?: number | undefined;
82
+ resources?: ResourceRow[] | undefined;
83
+ }
84
+
85
+ export type HealthStatus = 'up' | 'down' | 'unknown' | 'missing';
86
+
87
+ export interface ResourceRow {
88
+ key: string;
89
+ name: string;
90
+ label: string;
91
+ category: string;
92
+ endpoint?: string | undefined;
93
+ port?: number | undefined;
94
+ path?: string | undefined;
95
+ runtimeStatus: string;
96
+ isDisabled: boolean;
97
+ health: HealthStatus;
98
+ exists: boolean;
99
+ error?: string | undefined;
100
+ resourceKind: ResourceKind;
101
+ // New fields from UIResource status
102
+ updateStatus?: string | undefined;
103
+ waitingReason?: string | undefined;
104
+ waitingOn?: string[] | undefined;
105
+ lastDeployTime?: string | undefined;
106
+ lastBuildDuration?: number | undefined;
107
+ lastBuildError?: string | undefined;
108
+ hasPendingChanges?: boolean | undefined;
109
+ triggerMode?: number | undefined;
110
+ queued?: boolean | undefined;
111
+ order?: number | undefined;
112
+ pid?: number | undefined;
113
+ conditions?: Array<{ type: string; status: string; lastTransitionTime?: string }> | undefined;
114
+ }
115
+
116
+ /** Log-free status for a single environment (used in delta IPC) */
117
+ export interface EnvStatusUpdate {
118
+ status: 'stopped' | 'starting' | 'running';
119
+ tiltPort: number;
120
+ uptime: number | null;
121
+ newResources?: number | undefined;
122
+ resources?: ResourceRow[] | undefined;
123
+ }
124
+
125
+ /** Status push — resources + env state, NO logs */
126
+ export interface StatusUpdate {
127
+ envs: Record<string, EnvStatusUpdate>;
128
+ }
129
+
130
+ /** Incremental log append — only new lines since last push */
131
+ export interface LogDelta {
132
+ /** New launcher log lines per env (envId → lines) */
133
+ envLogs: Record<string, string[]>;
134
+ /** New resource log lines ("envId:resourceName" → lines) */
135
+ resourceLogs: Record<string, string[]>;
136
+ }
137
+
138
+ /** @deprecated Use StatusUpdate for push updates. Kept for initial full-fetch. */
139
+ export interface StatusResponse {
140
+ envs: Record<string, EnvStatus>;
141
+ health?: Record<string, HealthStatus>;
142
+ }
143
+
144
+ export interface DiscoverResult {
145
+ ok: boolean;
146
+ resources: CachedResource[];
147
+ logs: string[];
148
+ error?: string;
149
+ }
150
+
151
+ export interface LoginItemSettings {
152
+ openAtLogin: boolean;
153
+ }
154
+
155
+ export interface DirEntry {
156
+ name: string;
157
+ isDirectory: boolean;
158
+ isFile: boolean;
159
+ isSymlink: boolean;
160
+ /** Raw link target as returned by readlink (may be relative) */
161
+ symlinkTarget?: string | undefined;
162
+ /** Absolute resolved path when isSymlink is true */
163
+ realPath?: string | undefined;
164
+ }
165
+
166
+ export interface ReadDirResult {
167
+ ok: boolean;
168
+ path: string;
169
+ entries: DirEntry[];
170
+ error?: string | undefined;
171
+ }