@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.
@@ -0,0 +1,102 @@
1
+ import type { Config, DiscoverResult, LogDelta, StatusResponse, StatusUpdate } from './types.ts';
2
+ interface TiltManagerSDKOptions {
3
+ maxLogLines?: number;
4
+ /** @deprecated Use onStatusUpdate + onLogDelta instead */
5
+ onStatus?: (snapshot: StatusResponse) => void;
6
+ /** Push status updates (resources / env state — no logs) */
7
+ onStatusUpdate?: (update: StatusUpdate) => void;
8
+ /** Push incremental log appends */
9
+ onLogDelta?: (delta: LogDelta) => void;
10
+ /** Called when the SDK mutates config in-memory (e.g. cachedResources for external envs). */
11
+ onConfigMutated?: (config: Config) => void;
12
+ }
13
+ export declare class TiltManagerSDK {
14
+ private config;
15
+ private readonly maxLogLines;
16
+ private readonly onStatus;
17
+ private readonly onStatusUpdate;
18
+ private readonly onLogDelta;
19
+ private readonly onConfigMutated;
20
+ /** Tracks how many env log lines have been emitted per env */
21
+ private readonly emittedEnvLogIndex;
22
+ /** Tracks how many resource log lines have been emitted per key */
23
+ private readonly emittedResourceLogIndex;
24
+ private readonly processes;
25
+ private readonly logs;
26
+ private readonly startTimes;
27
+ private readonly discoveredResources;
28
+ private readonly tiltPortReachable;
29
+ private readonly healthByKey;
30
+ private readonly newResourceCount;
31
+ private readonly resourceLogProcesses;
32
+ private readonly resourceLogs;
33
+ private pollHandle;
34
+ private readonly wsConnections;
35
+ private readonly wsReconnectTimers;
36
+ private wsEnabled;
37
+ constructor(config: Config, options?: TiltManagerSDKOptions);
38
+ setConfig(next: Config): void;
39
+ /** Full snapshot including all logs — used for initial fetch or legacy compatibility */
40
+ currentStatusSnapshot(): StatusResponse;
41
+ /** Log-free status snapshot for all environments */
42
+ currentStatusUpdate(): StatusUpdate;
43
+ /** Full log snapshot for a single environment */
44
+ getEnvLogs(envId: string): {
45
+ envLogs: string[];
46
+ resourceLogs: Record<string, string[]>;
47
+ };
48
+ startPolling(intervalMs?: number): void;
49
+ stopPolling(): void;
50
+ startEnv(envId: string): {
51
+ ok: boolean;
52
+ error?: string;
53
+ };
54
+ stopEnv(envId: string): {
55
+ ok: boolean;
56
+ error?: string;
57
+ };
58
+ restartEnv(envId: string): {
59
+ ok: boolean;
60
+ error?: string;
61
+ };
62
+ triggerResource(envId: string, resourceName: string): Promise<{
63
+ ok: boolean;
64
+ error?: string;
65
+ }>;
66
+ enableResource(envId: string, resourceName: string): Promise<{
67
+ ok: boolean;
68
+ error?: string;
69
+ }>;
70
+ disableResource(envId: string, resourceName: string): Promise<{
71
+ ok: boolean;
72
+ error?: string;
73
+ }>;
74
+ discoverResources(input: {
75
+ tiltfilePath: string;
76
+ tiltPort: number;
77
+ timeoutMs?: number;
78
+ }): Promise<DiscoverResult>;
79
+ private emitStatus;
80
+ private appendLog;
81
+ private getResourceLogsForEnv;
82
+ private startResourceLogStreams;
83
+ private stopResourceLogStreams;
84
+ private envById;
85
+ private getEnvState;
86
+ private parseEndpoint;
87
+ private absoluteEndpoint;
88
+ private categoryFor;
89
+ private runCommand;
90
+ private runResourceCommand;
91
+ private parseUIResource;
92
+ private readTiltResources;
93
+ private tryConnect;
94
+ private runtimeHealth;
95
+ private computeHealth;
96
+ private getDisplayRows;
97
+ private connectWebSocket;
98
+ private disconnectWebSocket;
99
+ private handleWSMessage;
100
+ private pollTiltState;
101
+ }
102
+ export {};