@netlify/agent-runner-cli 1.58.4 → 1.58.6-alpha

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,7 +1,256 @@
1
- import { Options, ExecaChildProcess } from 'execa';
1
+ import * as os from 'os';
2
+ import { FdGenericOption as FdGenericOption$1 } from './arguments/specific.js';
3
+ import * as execa from 'execa';
4
+ import { Options, ResultPromise } from 'execa';
5
+ import { FromOption } from './fd-options.js';
6
+ import { Readable, Writable } from 'node:stream';
7
+ import { TransformStream, ReadableStream, WritableStream } from 'node:stream/web';
8
+ import { Unless, And, Not, Or, AndUnless } from '../utils.js';
9
+ import { GeneratorTransform, GeneratorTransformFull, DuplexTransform, WebTransform } from '../transform/normalize.js';
10
+ import * as stream from 'stream';
11
+
12
+ type VerboseOption = FdGenericOption$1<
13
+ | 'none'
14
+ | 'short'
15
+ | 'full'
16
+ | VerboseFunction
17
+ >;
18
+
19
+ type VerboseFunction = (verboseLine: string, verboseObject: MinimalVerboseObject) => string | void;
20
+
21
+ type GenericVerboseObject = {
22
+ /**
23
+ Event type. This can be:
24
+ - `'command'`: subprocess start
25
+ - `'output'`: `stdout`/`stderr` output
26
+ - `'ipc'`: IPC output
27
+ - `'error'`: subprocess failure
28
+ - `'duration'`: subprocess success or failure
29
+ */
30
+ type: 'command' | 'output' | 'ipc' | 'error' | 'duration';
31
+
32
+ /**
33
+ Depending on `verboseObject.type`, this is:
34
+ - `'command'`: the `result.escapedCommand`
35
+ - `'output'`: one line from `result.stdout` or `result.stderr`
36
+ - `'ipc'`: one IPC message from `result.ipcOutput`
37
+ - `'error'`: the `error.shortMessage`
38
+ - `'duration'`: the `result.durationMs`
39
+ */
40
+ message: string;
41
+
42
+ /**
43
+ The file and arguments that were run. This is the same as `result.escapedCommand`.
44
+ */
45
+ escapedCommand: string;
46
+
47
+ /**
48
+ Serial number identifying the subprocess within the current process. It is incremented from `'0'`.
49
+
50
+ This is helpful when multiple subprocesses are running at the same time.
51
+
52
+ This is similar to a [PID](https://en.wikipedia.org/wiki/Process_identifier) except it has no maximum limit, which means it never repeats. Also, it is usually shorter.
53
+ */
54
+ commandId: string;
55
+
56
+ /**
57
+ Event date/time.
58
+ */
59
+ timestamp: Date;
60
+
61
+ /**
62
+ Whether another subprocess is piped into this subprocess. This is `false` when `result.pipedFrom` is empty.
63
+ */
64
+ piped: boolean;
65
+ };
66
+
67
+ type MinimalVerboseObject = GenericVerboseObject & {
68
+ // We cannot use the `CommonOptions` type because it would make this type recursive
69
+ options: object;
70
+ result?: never;
71
+ };
72
+
73
+ // Options which can be fd-specific like `{verbose: {stdout: 'none', stderr: 'full'}}`
74
+ type FdGenericOption<OptionType> = OptionType | GenericOptionObject<OptionType>;
75
+
76
+ type GenericOptionObject<OptionType> = {
77
+ readonly [FdName in GenericFromOption]?: OptionType
78
+ };
79
+
80
+ type GenericFromOption = FromOption | 'ipc';
81
+
82
+ type DefaultEncodingOption = 'utf8';
83
+ type TextEncodingOption =
84
+ | DefaultEncodingOption
85
+ | 'utf16le';
86
+
87
+ type BufferEncodingOption = 'buffer';
88
+ type BinaryEncodingOption =
89
+ | BufferEncodingOption
90
+ | 'hex'
91
+ | 'base64'
92
+ | 'base64url'
93
+ | 'latin1'
94
+ | 'ascii';
95
+
96
+ // `options.encoding`
97
+ type EncodingOption =
98
+ | TextEncodingOption
99
+ | BinaryEncodingOption
100
+ | undefined;
101
+
102
+ // `options.stdio` when it is not an array
103
+ type SimpleStdioOption<
104
+ IsSync extends boolean,
105
+ IsExtra extends boolean,
106
+ IsArray extends boolean,
107
+ > =
108
+ | undefined
109
+ | 'pipe'
110
+ | Unless<And<And<Not<IsSync>, IsArray>, IsExtra>, 'inherit'>
111
+ | Unless<IsArray, 'ignore'>
112
+ | Unless<IsSync, 'overlapped'>;
113
+
114
+ // Values available in both `options.stdin|stdio` and `options.stdout|stderr|stdio`
115
+ type CommonStdioOption<
116
+ IsSync extends boolean,
117
+ IsExtra extends boolean,
118
+ IsArray extends boolean,
119
+ > =
120
+ | SimpleStdioOption<IsSync, IsExtra, IsArray>
121
+ | URL
122
+ | {readonly file: string; readonly append?: boolean}
123
+ | GeneratorTransform<IsSync>
124
+ | GeneratorTransformFull<IsSync>
125
+ | Unless<And<Not<IsSync>, IsArray>, 3 | 4 | 5 | 6 | 7 | 8 | 9>
126
+ | Unless<Or<IsSync, IsArray>, 'ipc'>
127
+ | Unless<IsSync, DuplexTransform | WebTransform | TransformStream>;
128
+
129
+ // Synchronous iterables excluding strings, Uint8Arrays and Arrays
130
+ type IterableObject<IsArray extends boolean> = Iterable<unknown>
131
+ & object
132
+ & {readonly BYTES_PER_ELEMENT?: never}
133
+ & AndUnless<IsArray, {readonly lastIndexOf?: never}>;
134
+
135
+ // `process.stdin|stdout|stderr` are `Duplex` with a `fd` property.
136
+ // This ensures they can only be passed to `stdin`/`stdout`/`stderr`, based on their direction.
137
+ type ProcessStdinFd = {readonly fd?: 0};
138
+ type ProcessStdoutStderrFd = {readonly fd?: 1 | 2};
139
+
140
+ // Values available only in `options.stdin|stdio`
141
+ type InputStdioOption<
142
+ IsSync extends boolean = boolean,
143
+ IsExtra extends boolean = boolean,
144
+ IsArray extends boolean = boolean,
145
+ > =
146
+ | 0
147
+ | Unless<And<IsSync, IsExtra>, Uint8Array | IterableObject<IsArray>>
148
+ | Unless<And<IsSync, IsArray>, Readable & ProcessStdinFd>
149
+ | Unless<IsSync, (AsyncIterable<unknown> & ProcessStdinFd) | ReadableStream>;
150
+
151
+ // Values available only in `options.stdout|stderr|stdio`
152
+ type OutputStdioOption<
153
+ IsSync extends boolean,
154
+ IsArray extends boolean,
155
+ > =
156
+ | 1
157
+ | 2
158
+ | Unless<And<IsSync, IsArray>, Writable & ProcessStdoutStderrFd>
159
+ | Unless<IsSync, WritableStream>;
160
+
161
+ // `options.stdin` array items
162
+ type StdinSingleOption<
163
+ IsSync extends boolean,
164
+ IsExtra extends boolean,
165
+ IsArray extends boolean,
166
+ > =
167
+ | CommonStdioOption<IsSync, IsExtra, IsArray>
168
+ | InputStdioOption<IsSync, IsExtra, IsArray>;
169
+
170
+ // `options.stdin`
171
+ type StdinOptionCommon<
172
+ IsSync extends boolean = boolean,
173
+ IsExtra extends boolean = boolean,
174
+ > =
175
+ | StdinSingleOption<IsSync, IsExtra, false>
176
+ | ReadonlyArray<StdinSingleOption<IsSync, IsExtra, true>>;
177
+
178
+ // `options.stdout|stderr` array items
179
+ type StdoutStderrSingleOption<
180
+ IsSync extends boolean,
181
+ IsExtra extends boolean,
182
+ IsArray extends boolean,
183
+ > =
184
+ | CommonStdioOption<IsSync, IsExtra, IsArray>
185
+ | OutputStdioOption<IsSync, IsArray>;
186
+
187
+ // `options.stdout|stderr`
188
+ type StdoutStderrOptionCommon<
189
+ IsSync extends boolean = boolean,
190
+ IsExtra extends boolean = boolean,
191
+ > =
192
+ | StdoutStderrSingleOption<IsSync, IsExtra, false>
193
+ | ReadonlyArray<StdoutStderrSingleOption<IsSync, IsExtra, true>>;
194
+
195
+ // `options.stdio[3+]`
196
+ type StdioExtraOptionCommon<IsSync extends boolean> =
197
+ | StdinOptionCommon<IsSync, true>
198
+ | StdoutStderrOptionCommon<IsSync, true>;
199
+
200
+ // `options.stdio` when it is an array
201
+ type StdioOptionsArray<IsSync extends boolean = boolean> = readonly [
202
+ StdinOptionCommon<IsSync, false>,
203
+ StdoutStderrOptionCommon<IsSync, false>,
204
+ StdoutStderrOptionCommon<IsSync, false>,
205
+ ...ReadonlyArray<StdioExtraOptionCommon<IsSync>>,
206
+ ];
207
+
208
+ // `options.stdio`
209
+ type StdioOptionsProperty<IsSync extends boolean = boolean> =
210
+ | SimpleStdioOption<IsSync, false, false>
211
+ | StdioOptionsArray<IsSync>;
2
212
 
3
213
  /** Run a command, with arguments being an array */
4
- declare const run: (file: string, args?: string[] | object, options?: Options) => ExecaChildProcess<string>;
214
+ declare const run: (file: string, args?: string[] | object, options?: Options) => ResultPromise<{
215
+ preferLocal?: boolean;
216
+ localDir?: string | URL;
217
+ node?: boolean;
218
+ nodeOptions?: readonly string[];
219
+ nodePath?: string | URL;
220
+ shell?: boolean | string | URL;
221
+ cwd?: string | URL;
222
+ env?: Readonly<Partial<Record<string, string>>>;
223
+ extendEnv?: boolean;
224
+ input?: string | Uint8Array | stream.Readable;
225
+ inputFile?: string | URL;
226
+ stdin?: StdinOptionCommon<false>;
227
+ stdout?: StdoutStderrOptionCommon<false>;
228
+ stderr?: StdoutStderrOptionCommon<false>;
229
+ stdio?: StdioOptionsProperty<false>;
230
+ all?: boolean;
231
+ encoding?: EncodingOption;
232
+ lines?: FdGenericOption<boolean>;
233
+ stripFinalNewline?: FdGenericOption<boolean>;
234
+ maxBuffer?: FdGenericOption<number>;
235
+ buffer?: FdGenericOption<boolean>;
236
+ ipc?: boolean | undefined;
237
+ serialization?: "json" | "advanced" | undefined;
238
+ ipcInput?: execa.Message | undefined;
239
+ verbose?: VerboseOption;
240
+ reject?: boolean;
241
+ timeout?: number;
242
+ cancelSignal?: AbortSignal | undefined;
243
+ gracefulCancel?: boolean | undefined;
244
+ forceKillAfterDelay?: number | boolean | undefined;
245
+ killSignal?: keyof os.SignalConstants | number;
246
+ detached?: boolean | undefined;
247
+ cleanup?: boolean | undefined;
248
+ uid?: number;
249
+ gid?: number;
250
+ argv0?: string;
251
+ windowsHide?: boolean;
252
+ windowsVerbatimArguments?: boolean;
253
+ }>;
5
254
 
6
255
  interface RunnerConfig {
7
256
  id: string;
@@ -11,11 +260,9 @@ interface RunnerConfig {
11
260
  model?: string;
12
261
  runner: string;
13
262
  useGateway: boolean;
14
- validateAgent: boolean;
15
263
  hasRepo: boolean;
16
264
  sha?: string;
17
265
  validateAgentWithBuild?: boolean;
18
- errorLogsPath?: string;
19
266
  }
20
267
 
21
268
  interface Context {
@@ -35,13 +282,12 @@ interface PipelineOptions {
35
282
  apiToken?: string;
36
283
  cliPath?: string;
37
284
  cwd?: string;
38
- errorLogsPath?: string;
39
285
  filter?: string;
40
286
  tracing?: {
41
287
  exporterUrl?: string;
42
288
  traceparent?: string;
43
289
  };
44
290
  }
45
- declare const runPipeline: ({ config, apiToken, cliPath, cwd, errorLogsPath, filter, tracing, }: PipelineOptions) => Promise<void>;
291
+ declare const runPipeline: ({ config, apiToken, cliPath, cwd, filter, tracing, }: PipelineOptions) => Promise<void>;
46
292
 
47
293
  export { type Context, type PipelineOptions, runPipeline };