@highstate/backend 0.4.1 → 0.4.3

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/dist/index.d.ts CHANGED
@@ -1,242 +1,71 @@
1
- import { Stack } from '@pulumi/pulumi/automation';
2
1
  import { z } from 'zod';
3
- import { ComponentModel, Entity, UnitRegistration, UnitSource } from '@highstate/contract';
4
-
5
- declare class LocalPulumiProjectHost {
6
- private lock;
7
- private password;
8
- hasPassword(): boolean;
9
- setPassword(password: string): void;
10
- runInline<T>(projectName: string, stackName: string, program: () => Promise<void> | Promise<Record<string, unknown>>, fn: (stack: Stack) => Promise<T>): Promise<T>;
11
- runLocal<T>(projectName: string, stackName: string, programPathResolver: () => Promise<string> | string, fn: (stack: Stack) => Promise<T>): Promise<T>;
12
- }
13
-
14
- declare const instanceStatusSchema: z.ZodEnum<["not_created", "updating", "destroying", "refreshing", "created", "error"]>;
15
- declare const instanceStateSchema: z.ZodObject<{
16
- key: z.ZodString;
17
- parentKey: z.ZodOptional<z.ZodString>;
18
- status: z.ZodEnum<["not_created", "updating", "destroying", "refreshing", "created", "error"]>;
19
- resources: z.ZodNumber;
20
- totalResources: z.ZodNumber;
21
- error: z.ZodOptional<z.ZodString>;
22
- message: z.ZodOptional<z.ZodString>;
23
- }, "strip", z.ZodTypeAny, {
24
- key: string;
25
- status: "not_created" | "updating" | "destroying" | "refreshing" | "created" | "error";
26
- resources: number;
27
- totalResources: number;
28
- error?: string | undefined;
29
- parentKey?: string | undefined;
30
- message?: string | undefined;
31
- }, {
32
- key: string;
33
- status: "not_created" | "updating" | "destroying" | "refreshing" | "created" | "error";
34
- resources: number;
35
- totalResources: number;
36
- error?: string | undefined;
37
- parentKey?: string | undefined;
38
- message?: string | undefined;
39
- }>;
40
- declare const operationType: z.ZodEnum<["update", "destroy", "recreate", "refresh"]>;
41
- declare const projectOperation: z.ZodObject<{
42
- type: z.ZodEnum<["update", "destroy", "recreate", "refresh"]>;
43
- instanceIds: z.ZodArray<z.ZodString, "many">;
44
- }, "strip", z.ZodTypeAny, {
45
- type: "update" | "destroy" | "recreate" | "refresh";
46
- instanceIds: string[];
47
- }, {
48
- type: "update" | "destroy" | "recreate" | "refresh";
49
- instanceIds: string[];
50
- }>;
51
- declare const projectStateSchema: z.ZodObject<{
52
- currentOperation: z.ZodOptional<z.ZodObject<{
53
- type: z.ZodEnum<["update", "destroy", "recreate", "refresh"]>;
54
- instanceIds: z.ZodArray<z.ZodString, "many">;
55
- }, "strip", z.ZodTypeAny, {
56
- type: "update" | "destroy" | "recreate" | "refresh";
57
- instanceIds: string[];
58
- }, {
59
- type: "update" | "destroy" | "recreate" | "refresh";
60
- instanceIds: string[];
61
- }>>;
62
- instances: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodObject<{
63
- key: z.ZodString;
64
- parentKey: z.ZodOptional<z.ZodString>;
65
- status: z.ZodEnum<["not_created", "updating", "destroying", "refreshing", "created", "error"]>;
66
- resources: z.ZodNumber;
67
- totalResources: z.ZodNumber;
68
- error: z.ZodOptional<z.ZodString>;
69
- message: z.ZodOptional<z.ZodString>;
70
- }, "strip", z.ZodTypeAny, {
71
- key: string;
72
- status: "not_created" | "updating" | "destroying" | "refreshing" | "created" | "error";
73
- resources: number;
74
- totalResources: number;
75
- error?: string | undefined;
76
- parentKey?: string | undefined;
77
- message?: string | undefined;
78
- }, {
79
- key: string;
80
- status: "not_created" | "updating" | "destroying" | "refreshing" | "created" | "error";
81
- resources: number;
82
- totalResources: number;
83
- error?: string | undefined;
84
- parentKey?: string | undefined;
85
- message?: string | undefined;
86
- }>>>;
87
- }, "strip", z.ZodTypeAny, {
88
- instances: Record<string, {
89
- key: string;
90
- status: "not_created" | "updating" | "destroying" | "refreshing" | "created" | "error";
91
- resources: number;
92
- totalResources: number;
93
- error?: string | undefined;
94
- parentKey?: string | undefined;
95
- message?: string | undefined;
96
- } | undefined>;
97
- currentOperation?: {
98
- type: "update" | "destroy" | "recreate" | "refresh";
99
- instanceIds: string[];
100
- } | undefined;
101
- }, {
102
- instances: Record<string, {
103
- key: string;
104
- status: "not_created" | "updating" | "destroying" | "refreshing" | "created" | "error";
105
- resources: number;
106
- totalResources: number;
107
- error?: string | undefined;
108
- parentKey?: string | undefined;
109
- message?: string | undefined;
110
- } | undefined>;
111
- currentOperation?: {
112
- type: "update" | "destroy" | "recreate" | "refresh";
113
- instanceIds: string[];
114
- } | undefined;
115
- }>;
116
- declare const positionSchema: z.ZodObject<{
117
- x: z.ZodNumber;
118
- y: z.ZodNumber;
119
- }, "strip", z.ZodTypeAny, {
120
- x: number;
121
- y: number;
122
- }, {
123
- x: number;
124
- y: number;
125
- }>;
126
- declare const outputRefSchema: z.ZodObject<{
127
- instanceId: z.ZodString;
128
- output: z.ZodString;
129
- }, "strip", z.ZodTypeAny, {
130
- instanceId: string;
131
- output: string;
132
- }, {
133
- instanceId: string;
134
- output: string;
135
- }>;
136
- declare const instanceModelSchema: z.ZodObject<{
137
- id: z.ZodString;
138
- type: z.ZodString;
139
- name: z.ZodString;
140
- position: z.ZodObject<{
141
- x: z.ZodNumber;
142
- y: z.ZodNumber;
143
- }, "strip", z.ZodTypeAny, {
144
- x: number;
145
- y: number;
146
- }, {
147
- x: number;
148
- y: number;
149
- }>;
150
- args: z.ZodRecord<z.ZodString, z.ZodAny>;
151
- inputs: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
152
- instanceId: z.ZodString;
153
- output: z.ZodString;
154
- }, "strip", z.ZodTypeAny, {
155
- instanceId: string;
156
- output: string;
157
- }, {
158
- instanceId: string;
159
- output: string;
160
- }>, z.ZodArray<z.ZodObject<{
161
- instanceId: z.ZodString;
162
- output: z.ZodString;
163
- }, "strip", z.ZodTypeAny, {
164
- instanceId: string;
165
- output: string;
166
- }, {
167
- instanceId: string;
168
- output: string;
169
- }>, "many">]>>;
170
- }, "strip", z.ZodTypeAny, {
171
- name: string;
172
- type: string;
173
- id: string;
174
- position: {
175
- x: number;
176
- y: number;
177
- };
178
- args: Record<string, any>;
179
- inputs: Record<string, {
180
- instanceId: string;
181
- output: string;
182
- } | {
183
- instanceId: string;
184
- output: string;
185
- }[]>;
186
- }, {
187
- name: string;
188
- type: string;
189
- id: string;
190
- position: {
191
- x: number;
192
- y: number;
193
- };
194
- args: Record<string, any>;
195
- inputs: Record<string, {
196
- instanceId: string;
197
- output: string;
198
- } | {
199
- instanceId: string;
200
- output: string;
201
- }[]>;
202
- }>;
203
- type OperationType = z.infer<typeof operationType>;
204
- type ProjectOperation = z.infer<typeof projectOperation>;
205
- type InstanceStatus = z.infer<typeof instanceStatusSchema>;
206
- type InstanceState = z.infer<typeof instanceStateSchema>;
207
- type ProjectState = z.infer<typeof projectStateSchema>;
208
- type Position = z.infer<typeof positionSchema>;
209
- type OutputRef = z.infer<typeof outputRefSchema>;
210
- type InstanceModel = z.infer<typeof instanceModelSchema>;
211
-
212
- declare const stringArrayType: z.ZodEffects<z.ZodString, string[], string>;
213
-
214
- declare function resolveMainLocalProject(projectPath: string | undefined, projectName: string | undefined): Promise<[projecPath: string, projectName: string]>;
2
+ import { WhoAmIResult, Stack, ConfigMap } from '@pulumi/pulumi/automation';
3
+ import { Logger } from 'pino';
4
+ import { ComponentModel, Entity, BaseInstanceModel, CompositeInstance, InstanceInputMap, UnitSource } from '@highstate/contract';
5
+ import { I as InstanceModel, P as Position, a as ProjectOperation, b as InstanceState, c as InstanceStatePatch, T as TerminalFactory, d as InstanceStatus, e as ProjectOperationRequest } from './operation-8k4Tv4dw.js';
6
+ import { BetterLock } from 'better-lock/dist/better_lock';
7
+ import { Stream, Writable, PassThrough } from 'node:stream';
215
8
 
216
9
  declare class SecretAccessDeniedError extends Error {
217
10
  constructor(projectId: string, key: string);
218
11
  }
219
12
  interface SecretBackend {
13
+ /**
14
+ * Check if the state and secrets of the project are locked.
15
+ * The backend may not implement this method.
16
+ *
17
+ * @param projectId The ID of the project.
18
+ *
19
+ * @returns `true` if the project is locked, `false` if the project is unlocked.
20
+ */
21
+ isLocked?(projectId: string): Promise<boolean>;
22
+ /**
23
+ * Unlock the state and secrets of the project.
24
+ * The backend may not implement this method.
25
+ *
26
+ * @param projectId The ID of the project.
27
+ * @param password The password to unlock the secrets.
28
+ *
29
+ * @returns `true` if the project is unlocked, `false` if the password is incorrect.
30
+ */
31
+ unlock?(projectId: string, password: string): Promise<boolean>;
220
32
  /**
221
33
  * Get the secrets of the component.
222
34
  *
223
35
  * @param projectId The ID of the project.
224
- * @param instanceKey The key of the component instance.
36
+ * @param instanceId The ID of the instance.
225
37
  *
226
38
  * @returns A record of secret key-value pairs or `null` if the secrets are not found.
227
39
  * @throws {SecretAccessDeniedError} If access to the secrets is denied.
228
40
  */
229
- get(projectId: string, instanceKey: string): Promise<Record<string, string>>;
41
+ get(projectId: string, instanceId: string): Promise<Record<string, unknown>>;
230
42
  /**
231
43
  * Set the secrets of the component.
232
44
  *
233
45
  * @param projectId The ID of the project.
234
- * @param instanceKey The key of the component instance.
46
+ * @param instanceId The ID of the instance.
235
47
  * @param values The record of secret key-value pairs.
236
48
  *
237
49
  * @throws {SecretAccessDeniedError} If access to the secrets is denied.
238
50
  */
239
- set(projectId: string, instanceKey: string, values: Record<string, string>): Promise<void>;
51
+ set(projectId: string, instanceId: string, values: Record<string, unknown>): Promise<void>;
52
+ }
53
+
54
+ declare class LocalPulumiHost {
55
+ private readonly logger;
56
+ private lock;
57
+ private constructor();
58
+ getCurrentUser(): Promise<WhoAmIResult | null>;
59
+ runInline<T>(projectId: string, pulumiProjectName: string, pulumiStackName: string, program: () => Promise<void> | Promise<Record<string, unknown>>, fn: (stack: Stack) => Promise<T>): Promise<T>;
60
+ runEmpty<T>(projectId: string, pulumiProjectName: string, pulumiStackName: string, fn: (stack: Stack) => Promise<T>): Promise<T>;
61
+ runLocal<T>(projectId: string, pulumiProjectName: string, pulumiStackName: string, programPathResolver: () => Promise<string> | string, fn: (stack: Stack) => Promise<T>, stackConfig?: ConfigMap): Promise<T>;
62
+ private sharedPassword;
63
+ private passwords;
64
+ hasPassword(projectId: string): boolean;
65
+ setPassword(projectId: string, password: string): void;
66
+ private getPassword;
67
+ static tryUnlockStack(stack: Stack, error: unknown): Promise<boolean>;
68
+ static create(logger: Logger): LocalPulumiHost;
240
69
  }
241
70
 
242
71
  declare const secretBackendConfig: z.ZodObject<{
@@ -252,22 +81,12 @@ declare const secretBackendConfig: z.ZodObject<{
252
81
  HIGHSTATE_BACKEND_SECRET_PROJECT_NAME?: string | undefined;
253
82
  HIGHSTATE_BACKEND_SECRET_TYPE?: "local" | undefined;
254
83
  }>;
255
- declare function createSecretBackend(config: z.infer<typeof secretBackendConfig>, pulumiProjectHost: LocalPulumiProjectHost): Promise<SecretBackend>;
84
+ declare function createSecretBackend(config: z.infer<typeof secretBackendConfig>, localPulumiHost: LocalPulumiHost, logger: Logger): Promise<SecretBackend>;
256
85
 
257
86
  type LibraryModel = Readonly<{
258
87
  components: Readonly<Record<string, ComponentModel>>;
259
88
  entities: Readonly<Record<string, Entity>>;
260
89
  }>;
261
- type EvaluationInput = {
262
- instanceId: string;
263
- output: string;
264
- };
265
- type EvaluationInstance = {
266
- type: string;
267
- name: string;
268
- args: Record<string, unknown>;
269
- inputs: Record<string, EvaluationInput | EvaluationInput[]>;
270
- };
271
90
  interface LibraryBackend {
272
91
  /**
273
92
  * Loads the library.
@@ -279,12 +98,18 @@ interface LibraryBackend {
279
98
  */
280
99
  watchLibrary?(signal?: AbortSignal): AsyncIterable<LibraryModel>;
281
100
  /**
282
- * Evaluates the instances and returns the stack registrations.
101
+ * Evaluates the instances and returns the evaluated composite instances.
283
102
  *
284
103
  * @param allInstances The all instances defined in the project.
285
- * @param instanceIds The instance IDs to evaluate. If not provided, all instances are evaluated.
104
+ * @param instanceIds The instance IDs to evaluate.
286
105
  */
287
- evaluateInstances(allInstances: Record<string, EvaluationInstance>, instanceIds?: string[]): Promise<Record<string, UnitRegistration>>;
106
+ evaluateCompositeInstances(allInstances: BaseInstanceModel[], instanceIds: string[]): Promise<readonly CompositeInstance[]>;
107
+ /**
108
+ * Evaluates the modules and returns the evaluated instances.
109
+ *
110
+ * @param modulePaths The module paths to evaluate.
111
+ */
112
+ evaluateModules(modulePaths: string[]): Promise<readonly BaseInstanceModel[]>;
288
113
  }
289
114
 
290
115
  declare const libraryBackendConfig: z.ZodObject<{
@@ -297,16 +122,27 @@ declare const libraryBackendConfig: z.ZodObject<{
297
122
  HIGHSTATE_BACKEND_LIBRARY_LOCAL_MODULES?: string | undefined;
298
123
  HIGHSTATE_BACKEND_LIBRARY_TYPE?: "local" | undefined;
299
124
  }>;
300
- declare function createLibraryBackend(config: z.infer<typeof libraryBackendConfig>): Promise<LibraryBackend>;
125
+ declare function createLibraryBackend(config: z.infer<typeof libraryBackendConfig>, logger: Logger): LibraryBackend;
301
126
 
302
127
  declare const configSchema: z.ZodObject<{
303
- HIGHSTATE_BACKEND_STATE_PROJECT_PATH: z.ZodOptional<z.ZodString>;
304
- HIGHSTATE_BACKEND_STATE_PROJECT_NAME: z.ZodOptional<z.ZodString>;
128
+ HIGHSTATE_BACKEND_LOGGER_NAME: z.ZodDefault<z.ZodString>;
129
+ HIGHSTATE_BACKEND_LOGGER_LEVEL: z.ZodDefault<z.ZodEnum<["fatal", "error", "warn", "info", "debug", "trace"]>>;
130
+ HIGHSTATE_BACKEND_WORKSPACE_LOCAL_DIR: z.ZodOptional<z.ZodString>;
131
+ HIGHSTATE_BACKEND_WORKSPACE_TYPE: z.ZodDefault<z.ZodEnum<["local"]>>;
132
+ HIGHSTATE_BACKEND_TERMINAL_DOCKER_BINARY: z.ZodDefault<z.ZodString>;
133
+ HIGHSTATE_BACKEND_TERMINAL_DOCKER_HOST: z.ZodOptional<z.ZodString>;
134
+ HIGHSTATE_BACKEND_TERMINAL_TYPE: z.ZodDefault<z.ZodEnum<["docker"]>>;
135
+ HIGHSTATE_BACKEND_RUNNER_LOCAL_SKIP_SOURCE_CHECK: z.ZodDefault<z.ZodBoolean>;
136
+ HIGHSTATE_BACKEND_RUNNER_LOCAL_SKIP_STATE_CHECK: z.ZodDefault<z.ZodBoolean>;
137
+ HIGHSTATE_BACKEND_RUNNER_LOCAL_PRINT_OUTPUT: z.ZodDefault<z.ZodBoolean>;
138
+ HIGHSTATE_BACKEND_RUNNER_LOCAL_SOURCE_BASE_PATH: z.ZodOptional<z.ZodString>;
139
+ HIGHSTATE_BACKEND_RUNNER_TYPE: z.ZodDefault<z.ZodEnum<["local"]>>;
140
+ HIGHSTATE_BACKEND_STATE_LOCAL_DIR: z.ZodOptional<z.ZodString>;
305
141
  HIGHSTATE_BACKEND_STATE_TYPE: z.ZodDefault<z.ZodEnum<["local"]>>;
306
142
  HIGHSTATE_BACKEND_SECRET_PROJECT_PATH: z.ZodOptional<z.ZodString>;
307
143
  HIGHSTATE_BACKEND_SECRET_PROJECT_NAME: z.ZodOptional<z.ZodString>;
308
144
  HIGHSTATE_BACKEND_SECRET_TYPE: z.ZodDefault<z.ZodEnum<["local"]>>;
309
- HIGHSTATE_BACKEND_PROJECT_BLUEPRINTS_DIR: z.ZodDefault<z.ZodString>;
145
+ HIGHSTATE_BACKEND_PROJECT_PROJECTS_DIR: z.ZodOptional<z.ZodString>;
310
146
  HIGHSTATE_BACKEND_PROJECT_TYPE: z.ZodDefault<z.ZodEnum<["local"]>>;
311
147
  HIGHSTATE_BACKEND_LIBRARY_LOCAL_MODULES: z.ZodDefault<z.ZodEffects<z.ZodString, string[], string>>;
312
148
  HIGHSTATE_BACKEND_LIBRARY_TYPE: z.ZodDefault<z.ZodEnum<["local"]>>;
@@ -314,195 +150,519 @@ declare const configSchema: z.ZodObject<{
314
150
  HIGHSTATE_BACKEND_SECRET_TYPE: "local";
315
151
  HIGHSTATE_BACKEND_LIBRARY_LOCAL_MODULES: string[];
316
152
  HIGHSTATE_BACKEND_LIBRARY_TYPE: "local";
317
- HIGHSTATE_BACKEND_PROJECT_BLUEPRINTS_DIR: string;
318
153
  HIGHSTATE_BACKEND_PROJECT_TYPE: "local";
319
154
  HIGHSTATE_BACKEND_STATE_TYPE: "local";
155
+ HIGHSTATE_BACKEND_RUNNER_LOCAL_SKIP_SOURCE_CHECK: boolean;
156
+ HIGHSTATE_BACKEND_RUNNER_LOCAL_SKIP_STATE_CHECK: boolean;
157
+ HIGHSTATE_BACKEND_RUNNER_LOCAL_PRINT_OUTPUT: boolean;
158
+ HIGHSTATE_BACKEND_RUNNER_TYPE: "local";
159
+ HIGHSTATE_BACKEND_TERMINAL_DOCKER_BINARY: string;
160
+ HIGHSTATE_BACKEND_TERMINAL_TYPE: "docker";
161
+ HIGHSTATE_BACKEND_WORKSPACE_TYPE: "local";
162
+ HIGHSTATE_BACKEND_LOGGER_NAME: string;
163
+ HIGHSTATE_BACKEND_LOGGER_LEVEL: "fatal" | "error" | "warn" | "info" | "debug" | "trace";
320
164
  HIGHSTATE_BACKEND_SECRET_PROJECT_PATH?: string | undefined;
321
165
  HIGHSTATE_BACKEND_SECRET_PROJECT_NAME?: string | undefined;
322
- HIGHSTATE_BACKEND_STATE_PROJECT_PATH?: string | undefined;
323
- HIGHSTATE_BACKEND_STATE_PROJECT_NAME?: string | undefined;
166
+ HIGHSTATE_BACKEND_PROJECT_PROJECTS_DIR?: string | undefined;
167
+ HIGHSTATE_BACKEND_STATE_LOCAL_DIR?: string | undefined;
168
+ HIGHSTATE_BACKEND_RUNNER_LOCAL_SOURCE_BASE_PATH?: string | undefined;
169
+ HIGHSTATE_BACKEND_TERMINAL_DOCKER_HOST?: string | undefined;
170
+ HIGHSTATE_BACKEND_WORKSPACE_LOCAL_DIR?: string | undefined;
324
171
  }, {
325
172
  HIGHSTATE_BACKEND_SECRET_PROJECT_PATH?: string | undefined;
326
173
  HIGHSTATE_BACKEND_SECRET_PROJECT_NAME?: string | undefined;
327
174
  HIGHSTATE_BACKEND_SECRET_TYPE?: "local" | undefined;
328
175
  HIGHSTATE_BACKEND_LIBRARY_LOCAL_MODULES?: string | undefined;
329
176
  HIGHSTATE_BACKEND_LIBRARY_TYPE?: "local" | undefined;
330
- HIGHSTATE_BACKEND_PROJECT_BLUEPRINTS_DIR?: string | undefined;
177
+ HIGHSTATE_BACKEND_PROJECT_PROJECTS_DIR?: string | undefined;
331
178
  HIGHSTATE_BACKEND_PROJECT_TYPE?: "local" | undefined;
332
- HIGHSTATE_BACKEND_STATE_PROJECT_PATH?: string | undefined;
333
- HIGHSTATE_BACKEND_STATE_PROJECT_NAME?: string | undefined;
179
+ HIGHSTATE_BACKEND_STATE_LOCAL_DIR?: string | undefined;
334
180
  HIGHSTATE_BACKEND_STATE_TYPE?: "local" | undefined;
181
+ HIGHSTATE_BACKEND_RUNNER_LOCAL_SKIP_SOURCE_CHECK?: boolean | undefined;
182
+ HIGHSTATE_BACKEND_RUNNER_LOCAL_SKIP_STATE_CHECK?: boolean | undefined;
183
+ HIGHSTATE_BACKEND_RUNNER_LOCAL_PRINT_OUTPUT?: boolean | undefined;
184
+ HIGHSTATE_BACKEND_RUNNER_LOCAL_SOURCE_BASE_PATH?: string | undefined;
185
+ HIGHSTATE_BACKEND_RUNNER_TYPE?: "local" | undefined;
186
+ HIGHSTATE_BACKEND_TERMINAL_DOCKER_BINARY?: string | undefined;
187
+ HIGHSTATE_BACKEND_TERMINAL_DOCKER_HOST?: string | undefined;
188
+ HIGHSTATE_BACKEND_TERMINAL_TYPE?: "docker" | undefined;
189
+ HIGHSTATE_BACKEND_WORKSPACE_LOCAL_DIR?: string | undefined;
190
+ HIGHSTATE_BACKEND_WORKSPACE_TYPE?: "local" | undefined;
191
+ HIGHSTATE_BACKEND_LOGGER_NAME?: string | undefined;
192
+ HIGHSTATE_BACKEND_LOGGER_LEVEL?: "fatal" | "error" | "warn" | "info" | "debug" | "trace" | undefined;
335
193
  }>;
336
194
  type Config = z.infer<typeof configSchema>;
337
195
  declare function loadConfig(env?: NodeJS.ProcessEnv, useDotenv?: boolean): Promise<Config>;
338
196
 
339
197
  interface ProjectBackend {
340
- getInstances(projectId: string): Promise<Record<string, InstanceModel>>;
341
- updateInstance(projectId: string, instance: InstanceModel): Promise<void>;
198
+ /**
199
+ * List the names of the available projects.
200
+ */
201
+ getProjectNames(): Promise<string[]>;
202
+ /**
203
+ * Get the instances of the project.
204
+ *
205
+ * @param projectId The ID of the project.
206
+ */
207
+ getInstances(projectId: string): Promise<InstanceModel[]>;
208
+ /**
209
+ * Create the instance of the project.
210
+ *
211
+ * @param projectId The ID of the project.
212
+ * @param instance The instance to update.
213
+ */
214
+ createInstance(projectId: string, instance: InstanceModel): Promise<InstanceModel>;
215
+ /**
216
+ * Change the position of the instance in the project.
217
+ *
218
+ * @param projectId The ID of the project.
219
+ * @param instanceId The ID of the instance to move.
220
+ * @param position The new position of the instance.
221
+ */
222
+ moveInstance(projectId: string, instanceId: string, position: Position): Promise<InstanceModel>;
223
+ /**
224
+ * Rename the instance of the project.
225
+ * Changes its id and updates all references to the instance.
226
+ * Potentially dangerous, but safe when the instance is not yet created.
227
+ */
228
+ renameInstance(projectId: string, instanceId: string, newName: string): Promise<InstanceModel>;
229
+ /**
230
+ * Update the arguments of the instance.
231
+ *
232
+ * @param projectId The ID of the project.
233
+ * @param instanceId The ID of the instance to update.
234
+ * @param args The new arguments of the instance.
235
+ */
236
+ updateInstanceArgs(projectId: string, instanceId: string, args: Record<string, unknown>): Promise<InstanceModel>;
237
+ /**
238
+ * Update the inputs of the instance.
239
+ *
240
+ * @param projectId The ID of the project.
241
+ * @param instanceId The ID of the instance to update.
242
+ * @param inputs The new inputs of the instance.
243
+ */
244
+ updateInstanceInputs(projectId: string, instanceId: string, inputs: InstanceInputMap): Promise<InstanceModel>;
245
+ /**
246
+ * Delete the instance of the project.
247
+ *
248
+ * @param projectId The ID of the project.
249
+ * @param instanceId The ID of the instance to delete.
250
+ */
342
251
  deleteInstance(projectId: string, instanceId: string): Promise<void>;
343
252
  }
344
253
 
345
- type UnitBaseOptions = {
254
+ declare class ProjectLock {
255
+ private readonly lock;
256
+ private readonly projectId;
257
+ constructor(lock: BetterLock, projectId: string);
258
+ lockInstance<T>(instanceId: string, fn: () => Promise<T>): Promise<T>;
259
+ lockInstances<T>(instanceIds: string[], fn: () => Promise<T>): Promise<T>;
260
+ }
261
+ declare class ProjectLockManager {
262
+ private readonly lock;
263
+ getLock(projectId: string): ProjectLock;
264
+ }
265
+
266
+ type LogEntry = [instanceId: string, line: string];
267
+ type EvaluatedCompositeInstance = CompositeInstance & {
268
+ /**
269
+ * The hash of the input of the instance at the moment of the evaluation.
270
+ */
271
+ inputHash: string;
272
+ };
273
+ interface StateBackend {
346
274
  /**
347
- * The name of the project to run.
275
+ * Gets the active operations which are not completed or failed.
348
276
  */
349
- projectName: string;
277
+ getActiveOperations(): Promise<ProjectOperation[]>;
350
278
  /**
351
- * The name of the stack to run.
279
+ * Gets recent operations of the project.
280
+ * If `beforeOperationId` is provided, returns the operations before the specified operation ID.
281
+ * The page size is fixed to 10.
282
+ *
283
+ * @param projectId The ID of the project.
284
+ * @param beforeOperationId The ID of the operation to get the operations before.
285
+ */
286
+ getOperations(projectId: string, beforeOperationId?: string): Promise<ProjectOperation[]>;
287
+ /**
288
+ * Gets the current (cached) instance states of the project.
289
+ * Actual states should be retrieved from the runner (and they are still may not be up-to-date).
290
+ *
291
+ * @param projectId The ID of the project.
292
+ */
293
+ getInstanceStates(projectId: string): Promise<InstanceState[]>;
294
+ /**
295
+ * Gets the current (cached) state of the instance.
296
+ *
297
+ * @param projectId The ID of the project.
298
+ * @param instanceId The ID of the instance.
299
+ */
300
+ getInstanceState(projectId: string, instanceId: string): Promise<InstanceState | undefined>;
301
+ /**
302
+ * Gets the affected instance states at the moment of the operation completion.
303
+ * The logs are not included.
304
+ *
305
+ * @param operationId The ID of the operation.
306
+ */
307
+ getAffectedInstanceStates(operationId: string): Promise<InstanceState[]>;
308
+ /**
309
+ * Gets the full logs of the instance at the moment of the operation completion.
310
+ *
311
+ * @param operationId The ID of the operation.
312
+ * @param instanceId The ID of the instance.
313
+ */
314
+ getInstanceLogs(operationId: string, instanceId: string): Promise<string[]>;
315
+ /**
316
+ * Puts the operation to the state.
317
+ * The operation must have a unique ID sortable chronologically.
318
+ * Also, the operation must have the project ID.
319
+ *
320
+ * @param operation The operation to put.
321
+ */
322
+ putOperation(operation: ProjectOperation): Promise<void>;
323
+ /**
324
+ * Puts the instance states affected by the operation to the state.
325
+ *
326
+ * @param projectId The ID of the project.
327
+ * @param operationId The ID of the operation.
328
+ * @param states The instance states to put.
329
+ */
330
+ putAffectedInstanceStates(projectId: string, operationId: string, states: InstanceState[]): Promise<void>;
331
+ /**
332
+ * Puts the instance states of the project to the state.
333
+ *
334
+ * @param projectId The ID of the project.
335
+ * @param states The instance states to put.
336
+ */
337
+ putInstanceStates(projectId: string, states: InstanceState[]): Promise<void>;
338
+ /**
339
+ * Appends the log lines to the instance logs.
340
+ *
341
+ * @param operationId The ID of the operation.
342
+ * @param logs The logs to append. Each log is a tuple of the instance ID and the log line.
343
+ */
344
+ appendInstanceLogs(operationId: string, logs: LogEntry[]): Promise<void>;
345
+ /**
346
+ * Gets the evaluated composite instance.
347
+ *
348
+ * @param projectId The ID of the project.
349
+ * @param instanceId The ID of the instance.
352
350
  */
353
- stackName: string;
351
+ getCompositeInstance(projectId: string, instanceId: string): Promise<EvaluatedCompositeInstance | null>;
352
+ /**
353
+ * Gets the input hash of the evaluated composite instance.
354
+ *
355
+ * @param projectId The ID of the project.
356
+ * @param instanceId The ID of the instance.
357
+ */
358
+ getCompositeInstanceInputHash(projectId: string, instanceId: string): Promise<string | null>;
359
+ /**
360
+ * Puts the evaluated composite instances of the project to the state.
361
+ *
362
+ * @param projectId The ID of the project.
363
+ * @param instances The instances to put.
364
+ */
365
+ putCompositeInstances(projectId: string, instances: EvaluatedCompositeInstance[]): Promise<void>;
366
+ /**
367
+ * Clears the evaluation state of the instance.
368
+ *
369
+ * @param projectId The ID of the project.
370
+ * @param instanceIds The IDs of the instances to clear.
371
+ */
372
+ clearCompositeInstances(projectId: string, instanceIds: string[]): Promise<void>;
373
+ }
374
+
375
+ declare class ProjectManager {
376
+ private readonly projectBackend;
377
+ private readonly stateBackend;
378
+ private readonly operationManager;
379
+ private readonly library;
380
+ private readonly logger;
381
+ private constructor();
382
+ getCompositeInstance(projectId: string, instanceId: string): Promise<CompositeInstance>;
383
+ createInstance(projectId: string, instance: InstanceModel): Promise<InstanceModel>;
384
+ updateInstanceArgs(projectId: string, instanceId: string, args: Record<string, unknown>): Promise<InstanceModel>;
385
+ updateInstanceInputs(projectId: string, instanceId: string, inputs: InstanceInputMap): Promise<InstanceModel>;
386
+ moveInstance(projectId: string, instanceId: string, position: Position): Promise<InstanceModel>;
387
+ renameInstance(projectId: string, instanceId: string, newName: string): Promise<InstanceModel>;
388
+ deleteInstance(projectId: string, instanceId: string): Promise<void>;
389
+ private updateInstanceChildren;
390
+ private waitForCompositeInstance;
391
+ static create(projectBackend: ProjectBackend, stateBackend: StateBackend, operationManager: OperationManager, library: LibraryBackend, logger: Logger): ProjectManager;
392
+ }
393
+
394
+ type RunnerBaseOptions = {
395
+ /**
396
+ * The HighState project ID.
397
+ */
398
+ projectId: string;
399
+ /**
400
+ * The type of the instance to run.
401
+ */
402
+ instanceType: string;
403
+ /**
404
+ * The name of the instance to run.
405
+ */
406
+ instanceName: string;
354
407
  /**
355
408
  * The signal to abort the operation.
356
409
  */
357
410
  signal?: AbortSignal;
358
411
  };
359
- type UnitRunOptions = UnitBaseOptions & {
412
+ type InstanceUpdateOptions = RunnerBaseOptions & {
360
413
  /**
361
414
  * The source of the unit.
362
415
  */
363
416
  source: UnitSource;
364
- };
365
- type UnitUpdateOptions = UnitRunOptions & {
366
417
  /**
367
418
  * The configuration of the stack.
368
419
  */
369
420
  config: Record<string, string>;
421
+ /**
422
+ * The values of the secrets.
423
+ */
424
+ secrets: Record<string, string>;
370
425
  };
371
- type UnitWatchOptions = UnitBaseOptions & {
426
+ type InstanceWatchOptions = RunnerBaseOptions & {
372
427
  /**
373
428
  * The final statuses to watch.
374
- * If the unit reaches one of these statuses, it should return the current state and exit.
429
+ * If the instance reaches one of these statuses, it should return the current state and exit.
375
430
  */
376
- finalStatuses: InstanceStatus[];
431
+ finalStatuses?: InstanceStatus[];
377
432
  };
378
433
  interface RunnerBackend {
379
434
  /**
380
- * Watches the unit state.
435
+ * Watches the instance state.
436
+ *
437
+ * Returns the async iterable of the instance state patches.
438
+ * The fields with `undefined` values should be ignored, and the fields with `null` values should be removed.
381
439
  */
382
- watch(options: UnitWatchOptions): AsyncIterable<InstanceState>;
440
+ watch(options: InstanceWatchOptions): AsyncIterable<InstanceStatePatch>;
383
441
  /**
384
- * Updates the unit.
442
+ * Gets the actual state of the instance.
443
+ */
444
+ getState(options: RunnerBaseOptions): Promise<InstanceState>;
445
+ /**
446
+ * Gets the content of the representation.
447
+ */
448
+ getRepresentationContent(options: RunnerBaseOptions): Promise<string | null>;
449
+ /**
450
+ * Gets the terminal factory.
451
+ */
452
+ getTerminalFactory(options: RunnerBaseOptions): Promise<TerminalFactory | null>;
453
+ /**
454
+ * Updates the instance.
385
455
  *
386
456
  * The operation must only be aborted by the signal, not even when the connection is closed.
387
- * If the unit is already updating, it should exit immediately.
388
- * If the unit is running another operation, it should throw an error.
457
+ * If the instance is already updating, it should exit immediately.
458
+ * If the instance is running another operation, it should throw an error.
389
459
  */
390
- update(options: UnitUpdateOptions): Promise<void>;
460
+ update(options: InstanceUpdateOptions): Promise<void>;
391
461
  /**
392
- * Destroys the unit.
462
+ * Destroys the instance.
393
463
  *
394
464
  * The operation must only be aborted by the signal, not even when the connection is closed.
395
- * If the unit is not created, it should exit immediately.
396
- * If the unit is running another operation, it should throw an error.
465
+ * If the instance is not created, it should exit immediately.
466
+ * If the instance is running another operation, it should throw an error.
397
467
  */
398
- destroy(options: UnitRunOptions): Promise<void>;
468
+ destroy(options: RunnerBaseOptions): Promise<void>;
399
469
  /**
400
- * Refreshes the unit.
470
+ * Refreshes the instance.
401
471
  *
402
472
  * The operation must only be aborted by the signal, not even when the connection is closed.
403
- * If the unit is not created, it should exit immediately.
404
- * If the unit is running another operation, it should throw an error.
405
- * If the unit is not running, it should exit immediately.
473
+ * If the instance is not created, it should exit immediately.
474
+ * If the instance is running another operation, it should throw an error.
475
+ * If the instance is not running, it should exit immediately.
406
476
  */
407
- refresh(options: UnitRunOptions): Promise<void>;
477
+ refresh(options: RunnerBaseOptions): Promise<void>;
408
478
  }
409
479
 
410
- interface StateBackend {
480
+ type OperationEvents = Record<string, [ProjectOperation]>;
481
+ type StateEvents = Record<string, [Partial<InstanceState>]>;
482
+ type CompositeInstanceEvents = Record<string, [CompositeInstance]>;
483
+ type InstanceLogsEvents = Record<string, [string]>;
484
+ declare class OperationManager {
485
+ private readonly runnerBackend;
486
+ private readonly stateBackend;
487
+ private readonly libraryBackend;
488
+ private readonly projectBackend;
489
+ private readonly secretBackend;
490
+ private readonly projectLockManager;
491
+ private readonly logger;
492
+ constructor(runnerBackend: RunnerBackend, stateBackend: StateBackend, libraryBackend: LibraryBackend, projectBackend: ProjectBackend, secretBackend: SecretBackend, projectLockManager: ProjectLockManager, logger: Logger);
493
+ private readonly operationEE;
494
+ private readonly stateEE;
495
+ private readonly compositeInstanceEE;
496
+ private readonly instanceLogsEE;
497
+ private readonly runtimeOperations;
411
498
  /**
412
- * Gets all the component states for a project.
499
+ * Watches for all instance state changes in the project.
413
500
  *
414
- * @param projectId The ID of the project.
501
+ * @param projectId The project ID to watch.
502
+ * @param signal The signal to abort the operation.
415
503
  */
416
- get(projectId: string): Promise<ProjectState>;
504
+ watchInstanceStates(projectId: string, signal?: AbortSignal): AsyncIterable<Partial<InstanceState>>;
417
505
  /**
418
- * Watch the component states for a project.
419
- * Returns an async iterable that emits the component states.
506
+ * Watches for all project operations in the project.
420
507
  *
421
- * @param projectId The ID of the project.
508
+ * @param projectId The project ID to watch.
509
+ * @param signal The signal to abort the operation.
422
510
  */
423
- watch?(projectId: string): AsyncIterable<InstanceState>;
511
+ watchOperations(projectId: string, signal?: AbortSignal): AsyncIterable<ProjectOperation>;
424
512
  /**
425
- * Updates the component states for a project.
426
- * Use `null` to delete a component state.
513
+ * Watches for changes in the composite instance.
427
514
  *
428
- * @param projectId The ID of the project.
429
- * @param state The new project state.
515
+ * @param projectId The project ID to watch.
516
+ * @param instanceId The instance ID to watch.
517
+ * @param signal The signal to abort the operation.
518
+ */
519
+ watchCompositeInstance(projectId: string, instanceId: string, signal?: AbortSignal): AsyncIterable<CompositeInstance>;
520
+ /**
521
+ * Watches for logs of the instance in the operation.
522
+ *
523
+ * @param operationId The operation ID to watch.
524
+ * @param instanceId The instance ID to watch.
525
+ * @param signal The signal to abort the operation.
526
+ */
527
+ watchInstanceLogs(operationId: string, instanceId: string, signal?: AbortSignal): AsyncIterable<string>;
528
+ /**
529
+ * Launches the project operation.
530
+ *
531
+ * @param request The operation request to launch.
430
532
  */
431
- set(projectId: string, state: ProjectState): Promise<void>;
533
+ launch(request: ProjectOperationRequest): Promise<void>;
534
+ /**
535
+ * Cancels the current operation.
536
+ * Does nothing if no operation is running.
537
+ */
538
+ cancel(operationId: string): void;
539
+ private startOperation;
540
+ static create(runnerBackend: RunnerBackend, stateBackend: StateBackend, libraryBackend: LibraryBackend, projectBackend: ProjectBackend, secretBackend: SecretBackend, projectLockManager: ProjectLockManager, logger: Logger): Promise<OperationManager>;
432
541
  }
433
542
 
434
- declare const stateBackendConfig: z.ZodObject<{
435
- HIGHSTATE_BACKEND_STATE_PROJECT_PATH: z.ZodOptional<z.ZodString>;
436
- HIGHSTATE_BACKEND_STATE_PROJECT_NAME: z.ZodOptional<z.ZodString>;
437
- HIGHSTATE_BACKEND_STATE_TYPE: z.ZodDefault<z.ZodEnum<["local"]>>;
543
+ type TerminalRunOptions = {
544
+ /**
545
+ * The factory to use.
546
+ */
547
+ factory: TerminalFactory;
548
+ /**
549
+ * The input stream.
550
+ */
551
+ stdin: Stream;
552
+ /**
553
+ * The output stream.
554
+ */
555
+ stdout: NodeJS.WritableStream;
556
+ /**
557
+ * The signal to abort the terminal.
558
+ */
559
+ signal?: AbortSignal;
560
+ };
561
+ interface TerminalBackend {
562
+ /**
563
+ * Creates a new terminal and runs it.
564
+ *
565
+ * @param options The options.
566
+ */
567
+ run(options: TerminalRunOptions): Promise<void>;
568
+ }
569
+
570
+ declare const terminalBackendConfig: z.ZodObject<{
571
+ HIGHSTATE_BACKEND_TERMINAL_DOCKER_BINARY: z.ZodDefault<z.ZodString>;
572
+ HIGHSTATE_BACKEND_TERMINAL_DOCKER_HOST: z.ZodOptional<z.ZodString>;
573
+ HIGHSTATE_BACKEND_TERMINAL_TYPE: z.ZodDefault<z.ZodEnum<["docker"]>>;
438
574
  }, "strip", z.ZodTypeAny, {
439
- HIGHSTATE_BACKEND_STATE_TYPE: "local";
440
- HIGHSTATE_BACKEND_STATE_PROJECT_PATH?: string | undefined;
441
- HIGHSTATE_BACKEND_STATE_PROJECT_NAME?: string | undefined;
575
+ HIGHSTATE_BACKEND_TERMINAL_DOCKER_BINARY: string;
576
+ HIGHSTATE_BACKEND_TERMINAL_TYPE: "docker";
577
+ HIGHSTATE_BACKEND_TERMINAL_DOCKER_HOST?: string | undefined;
442
578
  }, {
443
- HIGHSTATE_BACKEND_STATE_PROJECT_PATH?: string | undefined;
444
- HIGHSTATE_BACKEND_STATE_PROJECT_NAME?: string | undefined;
445
- HIGHSTATE_BACKEND_STATE_TYPE?: "local" | undefined;
579
+ HIGHSTATE_BACKEND_TERMINAL_DOCKER_BINARY?: string | undefined;
580
+ HIGHSTATE_BACKEND_TERMINAL_DOCKER_HOST?: string | undefined;
581
+ HIGHSTATE_BACKEND_TERMINAL_TYPE?: "docker" | undefined;
446
582
  }>;
447
- declare function createStateBackend(config: z.infer<typeof stateBackendConfig>, pulumiProjectHost: LocalPulumiProjectHost): Promise<StateBackend>;
583
+ declare function createTerminalBackend(config: z.infer<typeof terminalBackendConfig>, logger: Logger): TerminalBackend;
448
584
 
449
- declare class ProjectOperator {
450
- private readonly projectId;
451
- readonly state: ProjectState;
452
- private readonly runnerBackend;
453
- private readonly stateBackend;
454
- private readonly libraryBackend;
455
- private readonly projectBackend;
456
- private readonly secretBackend;
457
- constructor(projectId: string, state: ProjectState, runnerBackend: RunnerBackend, stateBackend: StateBackend, libraryBackend: LibraryBackend, projectBackend: ProjectBackend, secretBackend: SecretBackend);
458
- private readonly unitPromises;
459
- private readonly eventEmitter;
460
- private debouncedUpdateState;
461
- private abortController;
462
- watchInstanceStates(signal?: AbortSignal): AsyncIterable<InstanceState>;
463
- watchCurrentOperation(signal?: AbortSignal): AsyncIterable<ProjectOperation | undefined>;
585
+ type Terminal = {
586
+ readonly id: string;
587
+ readonly abortController: AbortController;
588
+ readonly stdin: PassThrough;
589
+ readonly stdout: PassThrough;
590
+ readonly history: string[];
591
+ attached: boolean;
592
+ };
593
+ declare class TerminalManager {
594
+ private readonly terminalBackend;
595
+ private readonly logger;
596
+ private readonly terminals;
597
+ private constructor();
598
+ create(factory: TerminalFactory): Terminal;
599
+ close(id: string): void;
600
+ attach(id: string, stdin: Stream, stdout: Writable, signal: AbortSignal): void;
601
+ private closeTerminalIfNotAttached;
602
+ static create(terminalBackend: TerminalBackend, logger: Logger): TerminalManager;
603
+ }
604
+
605
+ interface WorkspaceBackend {
464
606
  /**
465
- * Launches the project operation.
466
- * Throws an error if the operation is already running.
607
+ * Gets the layout of the workspace.
608
+ */
609
+ getWorkspaceLayout(): Promise<unknown>;
610
+ /**
611
+ * Sets the layout of the workspace.
612
+ */
613
+ setWorkspaceLayout(layout: unknown): Promise<void>;
614
+ /**
615
+ * Gets the viewport of the project.
467
616
  *
468
- * @param operation The operation to launch.
617
+ * @param projectId The ID of the project.
469
618
  */
470
- launch(operation: ProjectOperation): void;
619
+ getProjectViewport(projectId: string): Promise<unknown>;
471
620
  /**
472
- * Cancels the current operation.
473
- * Does nothing if no operation is running.
621
+ * Sets the viewport of the project.
622
+ *
623
+ * @param projectId The ID of the project.
474
624
  */
475
- cancel(): void;
476
- private operate;
477
- private upUnit;
478
- private getUnitConfig;
479
- private watchStateStream;
480
- private updateCurrentOperation;
481
- private updateInstanceState;
482
- private getOrCreateUnitPromise;
483
- static create(projectId: string, runnerBackend: RunnerBackend, stateBackend: StateBackend, libraryBackend: LibraryBackend, projectBackend: ProjectBackend, secretBackend: SecretBackend): Promise<ProjectOperator>;
484
- }
485
-
486
- declare class OperatorManager {
487
- private readonly runnerBackend;
488
- private readonly stateBackend;
489
- private readonly libraryBackend;
490
- private readonly projectBackend;
491
- private readonly secretBackend;
492
- private readonly operators;
493
- private readonly lock;
494
- constructor(runnerBackend: RunnerBackend, stateBackend: StateBackend, libraryBackend: LibraryBackend, projectBackend: ProjectBackend, secretBackend: SecretBackend);
495
- get(projectId: string): Promise<ProjectOperator>;
625
+ setProjectViewport(projectId: string, viewport: unknown): Promise<void>;
626
+ /**
627
+ * Gets the viewport of the composite instance.
628
+ *
629
+ * @param projectId The ID of the project.
630
+ * @param instanceId The ID of the instance.
631
+ */
632
+ getInstanceViewport(projectId: string, instanceId: string): Promise<unknown>;
633
+ /**
634
+ * Sets the viewport of the composite instance.
635
+ *
636
+ * @param projectId The ID of the project.
637
+ * @param instanceId The ID of the instance.
638
+ */
639
+ setInstanceViewport(projectId: string, instanceId: string, viewport: unknown): Promise<void>;
496
640
  }
497
641
 
498
642
  type Services = {
643
+ readonly logger: Logger;
499
644
  readonly libraryBackend: LibraryBackend;
500
645
  readonly secretBackend: SecretBackend;
501
646
  readonly runnerBackend: RunnerBackend;
502
647
  readonly projectBackend: ProjectBackend;
648
+ readonly projectManager: ProjectManager;
503
649
  readonly stateBackend: StateBackend;
504
- readonly operatorManager: OperatorManager;
650
+ readonly operationManager: OperationManager;
651
+ readonly terminalBackend: TerminalBackend;
652
+ readonly terminalManager: TerminalManager;
653
+ readonly workspaceBackend: WorkspaceBackend;
505
654
  };
506
- declare function createServices(config?: Config): Promise<Services>;
655
+ interface CreateServicesOptions {
656
+ /**
657
+ * The config to use. If not provided, it will be loaded from the environment.
658
+ */
659
+ readonly config?: Config;
660
+ /**
661
+ * The already created services to use. If the particular service is not provided, it will be created.
662
+ */
663
+ readonly services?: Partial<Services>;
664
+ }
665
+ declare function createServices({ config, services: { logger, libraryBackend, secretBackend, runnerBackend, projectBackend, projectManager, stateBackend, operationManager, terminalBackend, terminalManager, workspaceBackend, }, }?: CreateServicesOptions): Promise<Services>;
666
+ declare function getSharedServices(options?: CreateServicesOptions): Promise<Services>;
507
667
 
508
- export { type Config, type EvaluationInput, type EvaluationInstance, type InstanceModel, type InstanceState, type InstanceStatus, type LibraryBackend, type LibraryModel, LocalPulumiProjectHost, type OperationType, OperatorManager, type OutputRef, type Position, type ProjectOperation, ProjectOperator, type ProjectState, SecretAccessDeniedError, type SecretBackend, type Services, type StateBackend, createLibraryBackend, createSecretBackend, createServices, createStateBackend, instanceModelSchema, instanceStateSchema, instanceStatusSchema, libraryBackendConfig, loadConfig, operationType, outputRefSchema, positionSchema, projectOperation, projectStateSchema, resolveMainLocalProject, secretBackendConfig, stateBackendConfig, stringArrayType };
668
+ export { type CompositeInstanceEvents, type Config, type CreateServicesOptions, type InstanceLogsEvents, type LibraryBackend, type LibraryModel, type OperationEvents, OperationManager, SecretAccessDeniedError, type SecretBackend, type Services, type StateEvents, type TerminalBackend, TerminalManager, type TerminalRunOptions, createLibraryBackend, createSecretBackend, createServices, createTerminalBackend, getSharedServices, libraryBackendConfig, loadConfig, secretBackendConfig, terminalBackendConfig };