@pipelab/core-node 1.0.0-beta.26 → 1.0.0-beta.30

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,774 @@
1
+ /// <reference types="node" />
2
+ import { DEFAULT_NODE_VERSION, DEFAULT_PNPM_VERSION, SandboxFolder } from "@pipelab/constants";
3
+ import * as http$1 from "http";
4
+ import http from "http";
5
+ import { WebSocket } from "ws";
6
+ import * as _pipelab_shared0 from "@pipelab/shared";
7
+ import { Action, Agent, BuildHistoryEntry, Channels, End, Event as Event$1, Events, Expression, ExtractInputsFromAction, ExtractInputsFromEvent, ExtractInputsFromExpression, HandleListenerRendererSendFn, IBuildHistoryStorage, IpcMessage, RendererChannels, RendererData, RendererEnd, RendererEvents, RendererMessage, RendererPluginDefinition, RequestId, SetOutputActionFn, SetOutputExpressionFn, UpdateStatus, Variable, WebSocketConnectionState, WebSocketEvent, WebSocketHandler, WebSocketSendFunction } from "@pipelab/shared";
8
+ import * as execa from "execa";
9
+ import { Options as Options$1, Subprocess } from "execa";
10
+
11
+ //#region src/context.d.ts
12
+ declare const isDev: boolean;
13
+ type PipelabEnv = "dev" | "beta" | "prod";
14
+ declare const getDefaultUserDataPath: (env?: PipelabEnv) => string;
15
+ declare const projectRoot: string | null;
16
+ declare const CacheFolder: {
17
+ readonly Actions: "actions";
18
+ readonly Pipelines: "pipelines";
19
+ readonly Pacote: "pacote";
20
+ };
21
+ type CacheFolderType = (typeof CacheFolder)[keyof typeof CacheFolder];
22
+ interface PipelabContextOptions {
23
+ userDataPath: string;
24
+ releaseTag?: string;
25
+ }
26
+ type Join<T extends string[], D extends string> = T extends [] ? "" : T extends [infer F extends string] ? F : T extends [infer F extends string, ...infer R extends string[]] ? `${F}${D}${Join<R, D>}` : string;
27
+ declare class PipelabContext {
28
+ readonly userDataPath: string;
29
+ readonly releaseTag: string;
30
+ constructor(options: PipelabContextOptions);
31
+ getPackagesPath<S extends string[]>(...subpaths: S): `PACKAGES/${Join<S, "/">}`;
32
+ getThirdPartyPath<S extends string[]>(...subpaths: S): `THIRDPARTY/${Join<S, "/">}`;
33
+ getConfigPath<S extends string[]>(...subpaths: S): `CONFIG/${Join<S, "/">}`;
34
+ getSettingsPath(): `CONFIG/settings.json`;
35
+ getConnectionsPath(): `CONFIG/connections.json`;
36
+ getProjectsPath(): `CONFIG/projects.json`;
37
+ private _cachedSettings;
38
+ private _cachedSettingsTime;
39
+ private getSettings;
40
+ getTempPath<S extends string[]>(...subpaths: S): `TEMP/${Join<S, "/">}`;
41
+ createTempFolder<T extends string = "pipelab-">(prefix?: T): Promise<`TEMP/${T}${string}`>;
42
+ getCachePath(): `CACHE/`;
43
+ getCachePath<F extends CacheFolderType, S extends string[]>(folder: F, ...subpaths: S): `CACHE/${F}/${Join<S, "/">}`;
44
+ getPnpmPath<S extends string[]>(...subpaths: S): `PNPM/${Join<S, "/">}`;
45
+ getBuildHistoryPath<S extends string[]>(...subpaths: S): `BUILD_HISTORY/${Join<S, "/">}`;
46
+ getNodePath<V extends string = typeof DEFAULT_NODE_VERSION>(version?: V): `THIRDPARTY/node/${V}/${string}`;
47
+ getPnpmBinPath<V extends string = typeof DEFAULT_PNPM_VERSION>(version?: V): `PACKAGES/pnpm/${V}/bin/pnpm.cjs`;
48
+ getSandboxFolders(): Array<{
49
+ name: SandboxFolder;
50
+ label: string;
51
+ path: string;
52
+ }>;
53
+ }
54
+ //#endregion
55
+ //#region src/websocket-server.d.ts
56
+ interface ConnectedClient {
57
+ id: string;
58
+ name: string;
59
+ ws: WebSocket;
60
+ connectedAt: number;
61
+ }
62
+ declare class WebSocketServer {
63
+ private wss;
64
+ private server;
65
+ private isReady;
66
+ private readyResolve;
67
+ private connectionState;
68
+ private clients;
69
+ private lastBroadcasts;
70
+ start(port?: number, existingServer?: http$1.Server): Promise<void>;
71
+ private handleWebSocketMessage;
72
+ private sendError;
73
+ stop(): Promise<void>;
74
+ waitForReady(): Promise<void>;
75
+ isServerReady(): boolean;
76
+ getConnectionState(): WebSocketConnectionState;
77
+ getAgents(): Agent[];
78
+ getClient(ws: WebSocket): ConnectedClient | undefined;
79
+ /**
80
+ * Broadcasts a message to all connected clients.
81
+ * Useful for push notifications like auth state changes.
82
+ */
83
+ broadcast<KEY extends Channels>(channel: KEY, data: Events<KEY>): void;
84
+ }
85
+ declare const webSocketServer: WebSocketServer;
86
+ //#endregion
87
+ //#region src/ipc-core.d.ts
88
+ type HandleListenerSendFn<KEY extends Channels> = WebSocketSendFunction<KEY>;
89
+ type WsEvent = WebSocketEvent;
90
+ type HandleListener<KEY extends Channels> = WebSocketHandler<KEY>;
91
+ declare const useAPI: () => {
92
+ handle: <KEY extends Channels>(channel: KEY, listener: WebSocketHandler<KEY>) => {
93
+ channel: KEY;
94
+ listener: WebSocketHandler<KEY>;
95
+ };
96
+ processWebSocketMessage: (ws: WebSocket, channel: string, message: IpcMessage) => Promise<void> | undefined;
97
+ handlers: Record<string, WebSocketHandler<any>>;
98
+ };
99
+ //#endregion
100
+ //#region src/handlers/shell.d.ts
101
+ declare const registerShellHandlers: (_context: PipelabContext) => void;
102
+ //#endregion
103
+ //#region src/handlers/fs.d.ts
104
+ declare const registerFsHandlers: (_context: PipelabContext) => void;
105
+ //#endregion
106
+ //#region src/handlers/config.d.ts
107
+ declare const registerConfigHandlers: (context: PipelabContext) => void;
108
+ //#endregion
109
+ //#region src/handlers/history.d.ts
110
+ declare const registerHistoryHandlers: (context: PipelabContext) => void;
111
+ //#endregion
112
+ //#region src/handlers/engine.d.ts
113
+ declare const registerEngineHandlers: (context: PipelabContext) => void;
114
+ //#endregion
115
+ //#region src/handlers/agents.d.ts
116
+ declare const registerAgentsHandlers: (_context: PipelabContext) => void;
117
+ //#endregion
118
+ //#region src/handlers/build-history.d.ts
119
+ declare class BuildHistoryStorage implements IBuildHistoryStorage {
120
+ private context;
121
+ private logger;
122
+ constructor(context: PipelabContext);
123
+ private getStoragePath;
124
+ private getPipelinePath;
125
+ private ensureStoragePath;
126
+ private loadPipelineHistory;
127
+ private savePipelineHistory;
128
+ save(entry: BuildHistoryEntry): Promise<void>;
129
+ get(id: string, pipelineId?: string): Promise<BuildHistoryEntry | undefined>;
130
+ getAll(): Promise<BuildHistoryEntry[]>;
131
+ getByPipeline(pipelineId: string): Promise<BuildHistoryEntry[]>;
132
+ update(id: string, updates: Partial<BuildHistoryEntry>, pipelineId?: string): Promise<void>;
133
+ delete(id: string, pipelineId?: string): Promise<void>;
134
+ clear(): Promise<void>;
135
+ clearByPipeline(pipelineId: string): Promise<void>;
136
+ getStorageInfo(): Promise<{
137
+ totalEntries: number;
138
+ totalSize: number;
139
+ oldestEntry?: number;
140
+ newestEntry?: number;
141
+ numberOfPipelines: number;
142
+ userDataPath: string;
143
+ disk: {
144
+ total: number;
145
+ free: number;
146
+ pipelab: number;
147
+ folders: Array<{
148
+ name: SandboxFolder;
149
+ label: string;
150
+ size: number;
151
+ }>;
152
+ };
153
+ }>;
154
+ private getAllPipelineFiles;
155
+ private parsePipelineIdFromFilename;
156
+ }
157
+ //#endregion
158
+ //#region src/handlers/index.d.ts
159
+ declare const registerAllHandlers: (options: {
160
+ version: string;
161
+ context: PipelabContext;
162
+ }) => Promise<void>;
163
+ //#endregion
164
+ //#region src/config.d.ts
165
+ declare const setupSettingsConfigFile: (context: PipelabContext) => Promise<{
166
+ setConfig: (config: {
167
+ theme: "light" | "dark";
168
+ version: "7.0.0";
169
+ locale: "en-US" | "fr-FR" | "pt-BR" | "zh-CN" | "es-ES" | "de-DE";
170
+ tours: {
171
+ dashboard: {
172
+ step: number;
173
+ completed: boolean;
174
+ };
175
+ editor: {
176
+ step: number;
177
+ completed: boolean;
178
+ };
179
+ };
180
+ agents: {
181
+ id: string;
182
+ name: string;
183
+ url: string;
184
+ }[];
185
+ plugins: {
186
+ name: string;
187
+ enabled: boolean;
188
+ description: string;
189
+ }[];
190
+ autosave: boolean;
191
+ cacheFolder?: string | undefined;
192
+ tempFolder?: string | undefined;
193
+ }) => Promise<boolean>;
194
+ getConfig: () => Promise<{
195
+ theme: "light" | "dark";
196
+ version: "7.0.0";
197
+ locale: "en-US" | "fr-FR" | "pt-BR" | "zh-CN" | "es-ES" | "de-DE";
198
+ tours: {
199
+ dashboard: {
200
+ step: number;
201
+ completed: boolean;
202
+ };
203
+ editor: {
204
+ step: number;
205
+ completed: boolean;
206
+ };
207
+ };
208
+ agents: {
209
+ id: string;
210
+ name: string;
211
+ url: string;
212
+ }[];
213
+ plugins: {
214
+ name: string;
215
+ enabled: boolean;
216
+ description: string;
217
+ }[];
218
+ autosave: boolean;
219
+ cacheFolder?: string | undefined;
220
+ tempFolder?: string | undefined;
221
+ }>;
222
+ }>;
223
+ declare const setupConnectionsConfigFile: (context: PipelabContext) => Promise<{
224
+ setConfig: (config: {
225
+ version: "1.0.0";
226
+ connections: ({
227
+ id: string;
228
+ name: string;
229
+ pluginName: string;
230
+ createdAt: string;
231
+ isDefault: boolean;
232
+ } & {
233
+ [key: string]: unknown;
234
+ })[];
235
+ }) => Promise<boolean>;
236
+ getConfig: () => Promise<{
237
+ version: "1.0.0";
238
+ connections: ({
239
+ id: string;
240
+ name: string;
241
+ pluginName: string;
242
+ createdAt: string;
243
+ isDefault: boolean;
244
+ } & {
245
+ [key: string]: unknown;
246
+ })[];
247
+ }>;
248
+ }>;
249
+ declare const setupProjectsConfigFile: (context: PipelabContext) => Promise<{
250
+ setConfig: (config: {
251
+ version: "3.0.0";
252
+ projects: {
253
+ id: string;
254
+ name: string;
255
+ description: string;
256
+ }[];
257
+ pipelines?: ({
258
+ type: "external";
259
+ id: string;
260
+ summary: {
261
+ name: string;
262
+ plugins: string[];
263
+ description: string;
264
+ };
265
+ project: string;
266
+ path: string;
267
+ lastModified: string;
268
+ } | {
269
+ type: "internal";
270
+ id: string;
271
+ project: string;
272
+ lastModified: string;
273
+ configName: string;
274
+ } | {
275
+ type: "pipelab-cloud";
276
+ id: string;
277
+ project: string;
278
+ })[] | undefined;
279
+ }) => Promise<boolean>;
280
+ getConfig: () => Promise<{
281
+ version: "3.0.0";
282
+ projects: {
283
+ id: string;
284
+ name: string;
285
+ description: string;
286
+ }[];
287
+ pipelines?: ({
288
+ type: "external";
289
+ id: string;
290
+ summary: {
291
+ name: string;
292
+ plugins: string[];
293
+ description: string;
294
+ };
295
+ project: string;
296
+ path: string;
297
+ lastModified: string;
298
+ } | {
299
+ type: "internal";
300
+ id: string;
301
+ project: string;
302
+ lastModified: string;
303
+ configName: string;
304
+ } | {
305
+ type: "pipelab-cloud";
306
+ id: string;
307
+ project: string;
308
+ })[] | undefined;
309
+ }>;
310
+ }>;
311
+ declare const setupPipelineConfigFileByName: (name: string, context: PipelabContext) => Promise<{
312
+ setConfig: (config: {
313
+ version: "5.0.0";
314
+ name: string;
315
+ description: string;
316
+ variables: _pipelab_shared0.VariableBase[];
317
+ canvas: {
318
+ blocks: {
319
+ type: "action";
320
+ params: {
321
+ [x: string]: {
322
+ editor: "editor" | "simple";
323
+ value: unknown;
324
+ };
325
+ };
326
+ uid: string;
327
+ origin: {
328
+ pluginId: string;
329
+ nodeId: string;
330
+ version?: string | undefined;
331
+ };
332
+ name?: string | undefined;
333
+ disabled?: boolean | undefined;
334
+ }[];
335
+ triggers: {
336
+ type: "event";
337
+ params: {
338
+ [x: string]: any;
339
+ };
340
+ uid: string;
341
+ origin: {
342
+ pluginId: string;
343
+ nodeId: string;
344
+ version?: string | undefined;
345
+ };
346
+ }[];
347
+ };
348
+ }) => Promise<boolean>;
349
+ getConfig: () => Promise<{
350
+ version: "5.0.0";
351
+ name: string;
352
+ description: string;
353
+ variables: _pipelab_shared0.VariableBase[];
354
+ canvas: {
355
+ blocks: {
356
+ type: "action";
357
+ params: {
358
+ [x: string]: {
359
+ editor: "editor" | "simple";
360
+ value: unknown;
361
+ };
362
+ };
363
+ uid: string;
364
+ origin: {
365
+ pluginId: string;
366
+ nodeId: string;
367
+ version?: string | undefined;
368
+ };
369
+ name?: string | undefined;
370
+ disabled?: boolean | undefined;
371
+ }[];
372
+ triggers: {
373
+ type: "event";
374
+ params: {
375
+ [x: string]: any;
376
+ };
377
+ uid: string;
378
+ origin: {
379
+ pluginId: string;
380
+ nodeId: string;
381
+ version?: string | undefined;
382
+ };
383
+ }[];
384
+ };
385
+ }>;
386
+ }>;
387
+ declare const setupPipelineConfigFileByPath: (absolutePath: string, context: PipelabContext) => Promise<{
388
+ setConfig: (config: {
389
+ version: "5.0.0";
390
+ name: string;
391
+ description: string;
392
+ variables: _pipelab_shared0.VariableBase[];
393
+ canvas: {
394
+ blocks: {
395
+ type: "action";
396
+ params: {
397
+ [x: string]: {
398
+ editor: "editor" | "simple";
399
+ value: unknown;
400
+ };
401
+ };
402
+ uid: string;
403
+ origin: {
404
+ pluginId: string;
405
+ nodeId: string;
406
+ version?: string | undefined;
407
+ };
408
+ name?: string | undefined;
409
+ disabled?: boolean | undefined;
410
+ }[];
411
+ triggers: {
412
+ type: "event";
413
+ params: {
414
+ [x: string]: any;
415
+ };
416
+ uid: string;
417
+ origin: {
418
+ pluginId: string;
419
+ nodeId: string;
420
+ version?: string | undefined;
421
+ };
422
+ }[];
423
+ };
424
+ }) => Promise<boolean>;
425
+ getConfig: () => Promise<{
426
+ version: "5.0.0";
427
+ name: string;
428
+ description: string;
429
+ variables: _pipelab_shared0.VariableBase[];
430
+ canvas: {
431
+ blocks: {
432
+ type: "action";
433
+ params: {
434
+ [x: string]: {
435
+ editor: "editor" | "simple";
436
+ value: unknown;
437
+ };
438
+ };
439
+ uid: string;
440
+ origin: {
441
+ pluginId: string;
442
+ nodeId: string;
443
+ version?: string | undefined;
444
+ };
445
+ name?: string | undefined;
446
+ disabled?: boolean | undefined;
447
+ }[];
448
+ triggers: {
449
+ type: "event";
450
+ params: {
451
+ [x: string]: any;
452
+ };
453
+ uid: string;
454
+ origin: {
455
+ pluginId: string;
456
+ nodeId: string;
457
+ version?: string | undefined;
458
+ };
459
+ }[];
460
+ };
461
+ }>;
462
+ }>;
463
+ declare const deletePipelineConfigFileByName: (name: string, context: PipelabContext) => Promise<void>;
464
+ declare const deletePipelineConfigFileByPath: (absolutePath: string, context: PipelabContext) => Promise<void>;
465
+ //#endregion
466
+ //#region src/api.d.ts
467
+ type HandleListenerRenderer<KEY extends RendererChannels> = (event: Electron.IpcMainInvokeEvent, data: {
468
+ value: RendererData<KEY>;
469
+ send: HandleListenerRendererSendFn<KEY>;
470
+ }) => Promise<void>;
471
+ type ListenerMain<KEY extends RendererChannels> = (event: Electron.IpcMainEvent, data: RendererEvents<KEY>) => Promise<void>;
472
+ declare const usePluginAPI: (browserWindow: any) => {
473
+ send: <KEY extends RendererChannels>(channel: KEY, args?: RendererData<KEY>) => void;
474
+ on: <KEY extends RendererChannels>(channel: KEY | string, listener: (event: any, data: RendererEvents<KEY>) => void) => () => void;
475
+ execute: <KEY extends RendererChannels>(channel: KEY, data?: RendererData<KEY>, listener?: ListenerMain<KEY>) => Promise<RendererEnd<KEY>>;
476
+ };
477
+ type UseMainAPI = ReturnType<typeof usePluginAPI>;
478
+ //#endregion
479
+ //#region src/handler-func.d.ts
480
+ declare const handleActionExecute: (nodeId: string, pluginId: string, params: Record<string, string>, mainWindow: any | undefined, send: HandleListenerSendFn<"action:execute">, abortSignal: AbortSignal, cwd: string, cachePath: string, context: PipelabContext) => Promise<End<"action:execute">>;
481
+ //#endregion
482
+ //#region src/utils.d.ts
483
+ declare const getFinalPlugins: () => RendererPluginDefinition[];
484
+ declare const executeGraphWithHistory: ({
485
+ graph,
486
+ variables,
487
+ projectName,
488
+ projectPath,
489
+ pipelineId,
490
+ onNodeEnter,
491
+ onNodeExit,
492
+ onLog,
493
+ abortSignal,
494
+ mainWindow,
495
+ cachePath,
496
+ context
497
+ }: {
498
+ graph: any;
499
+ variables: Variable[];
500
+ projectName: string;
501
+ projectPath: string;
502
+ pipelineId: string;
503
+ onNodeEnter?: (node: any) => void;
504
+ onNodeExit?: (node: any) => void;
505
+ onLog?: (data: any, node?: any) => void;
506
+ abortSignal: AbortSignal;
507
+ mainWindow?: any;
508
+ cachePath: string;
509
+ context: PipelabContext;
510
+ }) => Promise<{
511
+ result: {
512
+ graph: Array<_pipelab_shared0.Block>;
513
+ definitions: Array<RendererPluginDefinition>;
514
+ variables: Array<Variable>;
515
+ steps: _pipelab_shared0.Steps;
516
+ context: _pipelab_shared0.Context;
517
+ onExecuteItem: (node: _pipelab_shared0.Block, params: Record<string, string>, steps: _pipelab_shared0.Steps) => Promise<_pipelab_shared0.End<"action:execute">>;
518
+ onNodeEnter: (node: _pipelab_shared0.Block) => void;
519
+ onNodeExit: (node: _pipelab_shared0.Block) => void;
520
+ abortSignal?: AbortSignal;
521
+ };
522
+ buildId: string;
523
+ }>;
524
+ //#endregion
525
+ //#region src/plugins-registry.d.ts
526
+ declare const loadPipelabPlugin: (id: string, options: {
527
+ context: PipelabContext;
528
+ }) => Promise<any>;
529
+ declare const loadCustomPlugin: (packageName: string, version: string, options: {
530
+ context: PipelabContext;
531
+ }) => Promise<any>;
532
+ declare function findInstalledPlugins(packagesDir: string): Promise<Array<{
533
+ name: string;
534
+ version: string;
535
+ packageDir: string;
536
+ description: string;
537
+ }>>;
538
+ declare const builtInPlugins: (options: {
539
+ context: PipelabContext;
540
+ }) => Promise<void>;
541
+ //#endregion
542
+ //#region src/utils/remote.d.ts
543
+ declare function isOnline(): Promise<boolean>;
544
+ type FetchOptions = {
545
+ installDeps?: boolean;
546
+ signal?: AbortSignal;
547
+ context: PipelabContext;
548
+ };
549
+ /**
550
+ * Robust utility to fetch, cache, and resolve an NPM package.
551
+ * Centralized in core-node to avoid circular dependencies.
552
+ */
553
+ declare function fetchPackage(packageName: string, versionOrRange: string, options: FetchOptions): Promise<{
554
+ packageDir: string;
555
+ resolvedVersion: string;
556
+ isLocal?: boolean;
557
+ entryPoint?: string;
558
+ }>;
559
+ /**
560
+ * Executes a pnpm install in a specific directory with a portable environment.
561
+ */
562
+ declare function runPnpm(cwd: string, options: {
563
+ args?: string[];
564
+ extraEnv?: Record<string, string>;
565
+ signal?: AbortSignal;
566
+ context: PipelabContext;
567
+ }): Promise<execa.Result<{
568
+ cwd: string;
569
+ all: true;
570
+ cancelSignal: AbortSignal | undefined;
571
+ env: {
572
+ NODE_ENV: string;
573
+ PATH: string | undefined;
574
+ PNPM_HOME: "PNPM/";
575
+ PNPM_ONLY_ALLOW_TRUSTED_DEPENDENCIES: string;
576
+ };
577
+ }>>;
578
+ /**
579
+ * Installs a specific version of Node.js if not already present.
580
+ */
581
+ declare function ensureNodeJS(context: PipelabContext, version?: string): Promise<string>;
582
+ /**
583
+ * Installs the PNPM package from npm if not already present.
584
+ */
585
+ declare function ensurePNPM(context: PipelabContext, version?: string): Promise<string>;
586
+ declare function fetchPipelabAsset(packageName: string, versionOrRange: string, options: FetchOptions): Promise<string>;
587
+ declare function fetchPipelabPlugin(pluginName: string, versionOrRange: string, options: FetchOptions): Promise<{
588
+ packageDir: string;
589
+ entryPoint: string;
590
+ isLocal: boolean;
591
+ }>;
592
+ declare function fetchPipelabCli(versionOrRange: string, options: FetchOptions): Promise<{
593
+ packageDir: string;
594
+ entryPoint: string;
595
+ isLocal: boolean;
596
+ }>;
597
+ //#endregion
598
+ //#region src/utils/fs-extras.d.ts
599
+ /**
600
+ * Ensures a directory exists and a file is created with default content if missing.
601
+ */
602
+ declare const ensure: (filesPath: string, defaultContent?: string) => Promise<void>;
603
+ /**
604
+ * Extracts a .tar.gz archive.
605
+ */
606
+ declare function extractTarGz(archivePath: string, destinationDir: string): Promise<void>;
607
+ /**
608
+ * Extracts a .zip archive.
609
+ */
610
+ declare function extractZip(archivePath: string, destinationDir: string): Promise<void>;
611
+ /**
612
+ * Zips a folder.
613
+ */
614
+ declare const zipFolder: (from: string, to: string, log?: typeof console.log, abortSignal?: AbortSignal) => Promise<string>;
615
+ /**
616
+ * Downloads a file with progress tracking.
617
+ */
618
+ interface DownloadHooks {
619
+ onProgress?: (data: {
620
+ progress: number;
621
+ downloadedSize: number;
622
+ }) => void;
623
+ }
624
+ declare const downloadFile: (url: string, localPath: string, hooks?: DownloadHooks, abortSignal?: AbortSignal) => Promise<void>;
625
+ declare const runWithLiveLogs: (command: string, args: string[], execaOptions: Options$1, log: typeof console.log, hooks?: {
626
+ onStdout?: (data: string, subprocess: Subprocess) => void;
627
+ onStderr?: (data: string, subprocess: Subprocess) => void;
628
+ onExit?: (code: number) => void;
629
+ onCreated?: (subprocess: Subprocess) => void;
630
+ }, abortSignal?: AbortSignal) => Promise<void>;
631
+ /**
632
+ * Calculates the total size of a directory recursively.
633
+ */
634
+ declare function getFolderSize(dirPath: string): Promise<number>;
635
+ //#endregion
636
+ //#region ../../node_modules/electron/electron.d.ts
637
+ declare module 'electron' {
638
+ export = Electron.CrossProcessExports;
639
+ }
640
+ declare module 'electron/main' {
641
+ export = Electron.Main;
642
+ }
643
+ declare module 'electron/common' {
644
+ export = Electron.Common;
645
+ }
646
+ declare module 'electron/renderer' {
647
+ export = Electron.Renderer;
648
+ }
649
+ declare module 'electron/utility' {
650
+ export = Electron.Utility;
651
+ }
652
+ declare module 'original-fs' {
653
+ import * as fs from 'fs';
654
+ export = fs;
655
+ }
656
+ declare module 'node:original-fs' {
657
+ import * as fs from 'fs';
658
+ export = fs;
659
+ }
660
+ //#endregion
661
+ //#region src/types/runner.d.ts
662
+ type RunnerCallbackFnArgument = {
663
+ done: () => void;
664
+ id: string;
665
+ log: (...args: Parameters<(typeof console)["log"]>) => void;
666
+ };
667
+ type ActionRunnerData<ACTION extends Action> = {
668
+ log: typeof console.log;
669
+ setOutput: SetOutputActionFn<ACTION>;
670
+ inputs: ExtractInputsFromAction<ACTION>;
671
+ setMeta: (callback: (data: ACTION["meta"]) => ACTION["meta"]) => void;
672
+ meta: ACTION["meta"];
673
+ cwd: string; /** @deprecated Use `context` instead to resolve sandboxed folders and binary paths. */
674
+ paths: {
675
+ cache: string;
676
+ pnpm: string;
677
+ node: string;
678
+ userData: string;
679
+ modules: string;
680
+ thirdparty: string;
681
+ };
682
+ browserWindow: BrowserWindow$1;
683
+ abortSignal: AbortSignal;
684
+ context: PipelabContext;
685
+ };
686
+ type ActionRunner<ACTION extends Action> = (data: ActionRunnerData<ACTION>) => Promise<void>;
687
+ type ExpressionRunner<EXPRESSION extends Expression> = (data: {
688
+ log: typeof console.log;
689
+ setOutput: SetOutputExpressionFn<EXPRESSION>;
690
+ inputs: ExtractInputsFromExpression<EXPRESSION>;
691
+ setMeta: (callback: (data: EXPRESSION["meta"]) => EXPRESSION["meta"]) => void;
692
+ meta: EXPRESSION["meta"];
693
+ cwd: string;
694
+ context: PipelabContext;
695
+ }) => Promise<string>;
696
+ type EventRunner<EVENT extends Event$1> = (data: {
697
+ log: typeof console.log;
698
+ inputs: ExtractInputsFromEvent<EVENT>;
699
+ setMeta: (callback: (data: EVENT["meta"]) => EVENT["meta"]) => void;
700
+ meta: EVENT["meta"];
701
+ cwd: string;
702
+ context: PipelabContext;
703
+ }) => Promise<void>;
704
+ type Runner = ActionRunner<any> | EventRunner<any>;
705
+ //#endregion
706
+ //#region src/runner.d.ts
707
+ interface RunOptions {
708
+ userData?: string;
709
+ variables?: string;
710
+ output?: string;
711
+ cloud?: boolean;
712
+ }
713
+ declare function runPipelineCommand(file: string, options: RunOptions, version: string): Promise<{
714
+ graph: Array<_pipelab_shared0.Block>;
715
+ definitions: Array<_pipelab_shared0.RendererPluginDefinition>;
716
+ variables: Array<_pipelab_shared0.Variable>;
717
+ steps: _pipelab_shared0.Steps;
718
+ context: _pipelab_shared0.Context;
719
+ onExecuteItem: (node: _pipelab_shared0.Block, params: Record<string, string>, steps: _pipelab_shared0.Steps) => Promise<_pipelab_shared0.End<"action:execute">>;
720
+ onNodeEnter: (node: _pipelab_shared0.Block) => void;
721
+ onNodeExit: (node: _pipelab_shared0.Block) => void;
722
+ abortSignal?: AbortSignal;
723
+ }>;
724
+ //#endregion
725
+ //#region src/server.d.ts
726
+ interface ServeOptions {
727
+ port: string | number;
728
+ userData?: string;
729
+ nodePath?: string;
730
+ pnpmPath?: string;
731
+ }
732
+ declare const sendStartupProgress: (message: string) => void;
733
+ declare const sendStartupReady: () => void;
734
+ declare function serveCommand(options: ServeOptions, version: string, _dirname: string): Promise<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>>;
735
+ //#endregion
736
+ //#region src/utils/github.d.ts
737
+ interface GitHubRelease {
738
+ tag_name: string;
739
+ prerelease: boolean;
740
+ published_at: string;
741
+ html_url: string;
742
+ assets: Array<{
743
+ name: string;
744
+ browser_download_url: string;
745
+ }>;
746
+ }
747
+ interface FetchReleaseOptions {
748
+ repo?: string;
749
+ allowPrerelease?: boolean;
750
+ }
751
+ /**
752
+ * Fetches all releases for a specific package from GitHub.
753
+ * Tags are expected to follow the pattern "{packageName}@{version}"
754
+ */
755
+ declare function fetchPackageReleases(packageName: string, options?: FetchReleaseOptions): Promise<GitHubRelease[]>;
756
+ /**
757
+ * Fetches the latest release for a specific package.
758
+ * Supports PIPELAB_OVERRIDE_RELEASE environment variable.
759
+ */
760
+ declare function fetchLatestPackageRelease(packageName: string, options?: FetchReleaseOptions): Promise<GitHubRelease | null>;
761
+ /**
762
+ * Fetches all releases from GitHub and finds the latest one that matches the Pipelab Desktop app tag.
763
+ * This ensures we don't accidentally pick a package release (e.g. @pipelab/shared) as the "latest".
764
+ */
765
+ declare function fetchLatestDesktopRelease(options?: FetchReleaseOptions): Promise<GitHubRelease | null>;
766
+ //#endregion
767
+ //#region src/fs-utils.d.ts
768
+ /**
769
+ * Checks if a path matches a critical user or system directory.
770
+ */
771
+ declare function isPathBlacklisted(pathToCheck: string): boolean;
772
+ //#endregion
773
+ export { type Action, ActionRunner, ActionRunnerData, BuildHistoryStorage, CacheFolder, CacheFolderType, ConnectedClient, DownloadHooks, type Event$1 as Event, EventRunner, type Expression, ExpressionRunner, type ExtractInputsFromAction, type ExtractInputsFromEvent, type ExtractInputsFromExpression, FetchOptions, FetchReleaseOptions, GitHubRelease, HandleListener, HandleListenerRenderer, type HandleListenerRendererSendFn, HandleListenerSendFn, ListenerMain, PipelabContext, PipelabContextOptions, PipelabEnv, type RendererChannels, type RendererData, type RendererEnd, type RendererEvents, type RendererMessage, type RequestId, RunOptions, Runner, RunnerCallbackFnArgument, ServeOptions, type SetOutputActionFn, type SetOutputExpressionFn, type UpdateStatus, UseMainAPI, WebSocketServer, WsEvent, builtInPlugins, deletePipelineConfigFileByName, deletePipelineConfigFileByPath, downloadFile, ensure, ensureNodeJS, ensurePNPM, executeGraphWithHistory, extractTarGz, extractZip, fetchLatestDesktopRelease, fetchLatestPackageRelease, fetchPackage, fetchPackageReleases, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, findInstalledPlugins, getDefaultUserDataPath, getFinalPlugins, getFolderSize, handleActionExecute, isDev, isOnline, isPathBlacklisted, loadCustomPlugin, loadPipelabPlugin, projectRoot, registerAgentsHandlers, registerAllHandlers, registerConfigHandlers, registerEngineHandlers, registerFsHandlers, registerHistoryHandlers, registerShellHandlers, runPipelineCommand, runPnpm, runWithLiveLogs, sendStartupProgress, sendStartupReady, serveCommand, setupConnectionsConfigFile, setupPipelineConfigFileByName, setupPipelineConfigFileByPath, setupProjectsConfigFile, setupSettingsConfigFile, useAPI, usePluginAPI, webSocketServer, zipFolder };
774
+ //# sourceMappingURL=index.d.cts.map