@hatchet-dev/typescript-sdk 0.16.0-alpha.1 → 0.16.0-alpha.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/clients/rest/generated/cloud/Api.d.ts +13 -0
- package/clients/rest/generated/cloud/Api.js +10 -0
- package/clients/rest/generated/cloud/data-contracts.d.ts +8 -0
- package/clients/worker/compute/compute-config.d.ts +62 -8
- package/clients/worker/compute/compute-config.js +28 -4
- package/clients/worker/compute/managed-compute.js +2 -0
- package/package.json +1 -1
- package/protoc/dispatcher/dispatcher.d.ts +19 -0
- package/protoc/dispatcher/dispatcher.js +368 -92
- package/protoc/events/events.js +45 -23
- package/protoc/google/protobuf/timestamp.js +5 -3
- package/protoc/workflows/workflows.js +153 -77
- package/step.d.ts +47 -5
- package/workflow.d.ts +177 -19
|
@@ -236,6 +236,19 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
236
236
|
/** The direction to sort the logs */
|
|
237
237
|
direction?: "forward" | "backward";
|
|
238
238
|
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<LogLineList, any>>;
|
|
239
|
+
/**
|
|
240
|
+
* @description Get the build logs for a specific build of a managed worker
|
|
241
|
+
*
|
|
242
|
+
* @tags Log
|
|
243
|
+
* @name IacLogsList
|
|
244
|
+
* @summary Get IaC Logs
|
|
245
|
+
* @request GET:/api/v1/cloud/managed-worker/{managed-worker}/iac-logs
|
|
246
|
+
* @secure
|
|
247
|
+
*/
|
|
248
|
+
iacLogsList: (managedWorker: string, query: {
|
|
249
|
+
/** The deploy key */
|
|
250
|
+
deployKey: string;
|
|
251
|
+
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<LogLineList, any>>;
|
|
239
252
|
/**
|
|
240
253
|
* @description Get all instances for a managed worker
|
|
241
254
|
*
|
|
@@ -202,6 +202,16 @@ class Api extends http_client_1.HttpClient {
|
|
|
202
202
|
* @secure
|
|
203
203
|
*/
|
|
204
204
|
this.logList = (managedWorker, query, params = {}) => this.request(Object.assign({ path: `/api/v1/cloud/managed-worker/${managedWorker}/logs`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
205
|
+
/**
|
|
206
|
+
* @description Get the build logs for a specific build of a managed worker
|
|
207
|
+
*
|
|
208
|
+
* @tags Log
|
|
209
|
+
* @name IacLogsList
|
|
210
|
+
* @summary Get IaC Logs
|
|
211
|
+
* @request GET:/api/v1/cloud/managed-worker/{managed-worker}/iac-logs
|
|
212
|
+
* @secure
|
|
213
|
+
*/
|
|
214
|
+
this.iacLogsList = (managedWorker, query, params = {}) => this.request(Object.assign({ path: `/api/v1/cloud/managed-worker/${managedWorker}/iac-logs`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
205
215
|
/**
|
|
206
216
|
* @description Get all instances for a managed worker
|
|
207
217
|
*
|
|
@@ -268,6 +268,14 @@ export interface CreateManagedWorkerRuntimeConfigRequest {
|
|
|
268
268
|
* @max 65536
|
|
269
269
|
*/
|
|
270
270
|
memoryMb: number;
|
|
271
|
+
/** The kind of GPU to use for the worker */
|
|
272
|
+
gpuKind?: 'a10' | 'l40s' | 'a100-40gb' | 'a100-80gb';
|
|
273
|
+
/**
|
|
274
|
+
* The number of GPUs to use for the worker
|
|
275
|
+
* @min 1
|
|
276
|
+
* @max 8
|
|
277
|
+
*/
|
|
278
|
+
gpus?: number;
|
|
271
279
|
actions?: string[];
|
|
272
280
|
/**
|
|
273
281
|
* @min 1
|
|
@@ -24,30 +24,58 @@ export declare const SharedCPUComputeSchema: z.ZodObject<z.objectUtil.extendShap
|
|
|
24
24
|
regions?: ManagedWorkerRegion[] | undefined;
|
|
25
25
|
}>;
|
|
26
26
|
export type SharedCPUCompute = z.infer<typeof SharedCPUComputeSchema>;
|
|
27
|
-
export declare const
|
|
27
|
+
export declare const PerformanceCPUComputeSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
28
28
|
pool: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
29
29
|
numReplicas: z.ZodDefault<z.ZodNumber>;
|
|
30
30
|
regions: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof ManagedWorkerRegion>, "many">>;
|
|
31
31
|
cpus: z.ZodNumber;
|
|
32
32
|
}, {
|
|
33
|
-
cpuKind: z.ZodLiteral<"
|
|
33
|
+
cpuKind: z.ZodLiteral<"performance">;
|
|
34
34
|
memoryMb: z.ZodEffects<z.ZodNumber, number, number>;
|
|
35
35
|
}>, "strip", z.ZodTypeAny, {
|
|
36
36
|
numReplicas: number;
|
|
37
37
|
cpus: number;
|
|
38
|
-
cpuKind: "
|
|
38
|
+
cpuKind: "performance";
|
|
39
39
|
memoryMb: number;
|
|
40
40
|
pool?: string | undefined;
|
|
41
41
|
regions?: ManagedWorkerRegion[] | undefined;
|
|
42
42
|
}, {
|
|
43
43
|
cpus: number;
|
|
44
|
-
cpuKind: "
|
|
44
|
+
cpuKind: "performance";
|
|
45
45
|
memoryMb: number;
|
|
46
46
|
pool?: string | undefined;
|
|
47
47
|
numReplicas?: number | undefined;
|
|
48
48
|
regions?: ManagedWorkerRegion[] | undefined;
|
|
49
49
|
}>;
|
|
50
|
-
export type
|
|
50
|
+
export type PerformanceCPUCompute = z.infer<typeof PerformanceCPUComputeSchema>;
|
|
51
|
+
export declare const GPUComputeSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
52
|
+
pool: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
53
|
+
numReplicas: z.ZodDefault<z.ZodNumber>;
|
|
54
|
+
regions: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof ManagedWorkerRegion>, "many">>;
|
|
55
|
+
cpus: z.ZodNumber;
|
|
56
|
+
}, {
|
|
57
|
+
cpuKind: z.ZodLiteral<"shared">;
|
|
58
|
+
gpuKind: z.ZodEnum<["a10", "l40s", "a100-40gb", "a100-80gb"]>;
|
|
59
|
+
regions: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodNativeEnum<typeof ManagedWorkerRegion>, "many">, ManagedWorkerRegion[], ManagedWorkerRegion[]>>;
|
|
60
|
+
memoryMb: z.ZodEffects<z.ZodNumber, number, number>;
|
|
61
|
+
}>, "strip", z.ZodTypeAny, {
|
|
62
|
+
numReplicas: number;
|
|
63
|
+
cpus: number;
|
|
64
|
+
cpuKind: "shared";
|
|
65
|
+
memoryMb: number;
|
|
66
|
+
gpuKind: "a10" | "l40s" | "a100-40gb" | "a100-80gb";
|
|
67
|
+
pool?: string | undefined;
|
|
68
|
+
regions?: ManagedWorkerRegion[] | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
cpus: number;
|
|
71
|
+
cpuKind: "shared";
|
|
72
|
+
memoryMb: number;
|
|
73
|
+
gpuKind: "a10" | "l40s" | "a100-40gb" | "a100-80gb";
|
|
74
|
+
pool?: string | undefined;
|
|
75
|
+
numReplicas?: number | undefined;
|
|
76
|
+
regions?: ManagedWorkerRegion[] | undefined;
|
|
77
|
+
}>;
|
|
78
|
+
export type GPUCompute = z.infer<typeof GPUComputeSchema>;
|
|
51
79
|
export declare const ComputeSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
52
80
|
pool: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
53
81
|
numReplicas: z.ZodDefault<z.ZodNumber>;
|
|
@@ -76,19 +104,45 @@ export declare const ComputeSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendS
|
|
|
76
104
|
regions: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof ManagedWorkerRegion>, "many">>;
|
|
77
105
|
cpus: z.ZodNumber;
|
|
78
106
|
}, {
|
|
79
|
-
cpuKind: z.ZodLiteral<"
|
|
107
|
+
cpuKind: z.ZodLiteral<"performance">;
|
|
80
108
|
memoryMb: z.ZodEffects<z.ZodNumber, number, number>;
|
|
81
109
|
}>, "strip", z.ZodTypeAny, {
|
|
82
110
|
numReplicas: number;
|
|
83
111
|
cpus: number;
|
|
84
|
-
cpuKind: "
|
|
112
|
+
cpuKind: "performance";
|
|
85
113
|
memoryMb: number;
|
|
86
114
|
pool?: string | undefined;
|
|
87
115
|
regions?: ManagedWorkerRegion[] | undefined;
|
|
88
116
|
}, {
|
|
89
117
|
cpus: number;
|
|
90
|
-
cpuKind: "
|
|
118
|
+
cpuKind: "performance";
|
|
119
|
+
memoryMb: number;
|
|
120
|
+
pool?: string | undefined;
|
|
121
|
+
numReplicas?: number | undefined;
|
|
122
|
+
regions?: ManagedWorkerRegion[] | undefined;
|
|
123
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
124
|
+
pool: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
125
|
+
numReplicas: z.ZodDefault<z.ZodNumber>;
|
|
126
|
+
regions: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof ManagedWorkerRegion>, "many">>;
|
|
127
|
+
cpus: z.ZodNumber;
|
|
128
|
+
}, {
|
|
129
|
+
cpuKind: z.ZodLiteral<"shared">;
|
|
130
|
+
gpuKind: z.ZodEnum<["a10", "l40s", "a100-40gb", "a100-80gb"]>;
|
|
131
|
+
regions: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodNativeEnum<typeof ManagedWorkerRegion>, "many">, ManagedWorkerRegion[], ManagedWorkerRegion[]>>;
|
|
132
|
+
memoryMb: z.ZodEffects<z.ZodNumber, number, number>;
|
|
133
|
+
}>, "strip", z.ZodTypeAny, {
|
|
134
|
+
numReplicas: number;
|
|
135
|
+
cpus: number;
|
|
136
|
+
cpuKind: "shared";
|
|
137
|
+
memoryMb: number;
|
|
138
|
+
gpuKind: "a10" | "l40s" | "a100-40gb" | "a100-80gb";
|
|
139
|
+
pool?: string | undefined;
|
|
140
|
+
regions?: ManagedWorkerRegion[] | undefined;
|
|
141
|
+
}, {
|
|
142
|
+
cpus: number;
|
|
143
|
+
cpuKind: "shared";
|
|
91
144
|
memoryMb: number;
|
|
145
|
+
gpuKind: "a10" | "l40s" | "a100-40gb" | "a100-80gb";
|
|
92
146
|
pool?: string | undefined;
|
|
93
147
|
numReplicas?: number | undefined;
|
|
94
148
|
regions?: ManagedWorkerRegion[] | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.computeHash = exports.ComputeSchema = exports.
|
|
3
|
+
exports.computeHash = exports.ComputeSchema = exports.GPUComputeSchema = exports.PerformanceCPUComputeSchema = exports.SharedCPUComputeSchema = void 0;
|
|
4
4
|
const data_contracts_1 = require("../../rest/generated/cloud/data-contracts");
|
|
5
5
|
const crypto_1 = require("crypto");
|
|
6
6
|
const zod_1 = require("zod");
|
|
@@ -34,8 +34,8 @@ exports.SharedCPUComputeSchema = BaseComputeSchema.extend({
|
|
|
34
34
|
.refine((val) => val % 256 === 0, { message: 'Must be divisible by 256 MB' })
|
|
35
35
|
.describe('The amount of memory in MB to use for the worker'),
|
|
36
36
|
});
|
|
37
|
-
exports.
|
|
38
|
-
cpuKind: zod_1.z.literal('
|
|
37
|
+
exports.PerformanceCPUComputeSchema = BaseComputeSchema.extend({
|
|
38
|
+
cpuKind: zod_1.z.literal('performance'),
|
|
39
39
|
memoryMb: zod_1.z
|
|
40
40
|
.number()
|
|
41
41
|
.int()
|
|
@@ -44,7 +44,31 @@ exports.DedicatedCPUComputeSchema = BaseComputeSchema.extend({
|
|
|
44
44
|
.refine((val) => val % 256 === 0, { message: 'Must be divisible by 256 MB' })
|
|
45
45
|
.describe('The amount of memory in MB to use for the worker'),
|
|
46
46
|
});
|
|
47
|
-
|
|
47
|
+
// eslint-disable-next-line no-shadow
|
|
48
|
+
const AllowedGPUManagedWorkerRegions = [data_contracts_1.ManagedWorkerRegion.Ord];
|
|
49
|
+
exports.GPUComputeSchema = BaseComputeSchema.extend({
|
|
50
|
+
cpuKind: zod_1.z.literal('shared'),
|
|
51
|
+
gpuKind: zod_1.z.enum(['a10', 'l40s', 'a100-40gb', 'a100-80gb']),
|
|
52
|
+
regions: zod_1.z
|
|
53
|
+
.array(zod_1.z.nativeEnum(data_contracts_1.ManagedWorkerRegion))
|
|
54
|
+
.refine((val) => val.every((region) => AllowedGPUManagedWorkerRegions.includes(region)), {
|
|
55
|
+
message: 'Invalid GPU region',
|
|
56
|
+
})
|
|
57
|
+
.optional()
|
|
58
|
+
.describe('The regions to deploy the worker to'),
|
|
59
|
+
memoryMb: zod_1.z
|
|
60
|
+
.number()
|
|
61
|
+
.int()
|
|
62
|
+
.min(2048, { message: 'Must be at least 1024 MB' })
|
|
63
|
+
.max(65536, { message: 'Must be at most 65536 MB' })
|
|
64
|
+
.refine((val) => val % 256 === 0, { message: 'Must be divisible by 256 MB' })
|
|
65
|
+
.describe('The amount of memory in MB to use for the worker'),
|
|
66
|
+
});
|
|
67
|
+
exports.ComputeSchema = zod_1.z.union([
|
|
68
|
+
exports.SharedCPUComputeSchema,
|
|
69
|
+
exports.PerformanceCPUComputeSchema,
|
|
70
|
+
exports.GPUComputeSchema,
|
|
71
|
+
]);
|
|
48
72
|
const computeHash = (compute) => {
|
|
49
73
|
const str = JSON.stringify(compute);
|
|
50
74
|
return (0, crypto_1.createHash)('sha256').update(str).digest('hex');
|
|
@@ -50,6 +50,7 @@ class ManagedCompute {
|
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
const key = (0, compute_config_1.computeHash)(compute);
|
|
53
|
+
const gpuKind = 'gpuKind' in compute ? compute.gpuKind : undefined;
|
|
53
54
|
if (!computeMap[key]) {
|
|
54
55
|
computeMap[key] = {
|
|
55
56
|
actions: [],
|
|
@@ -59,6 +60,7 @@ class ManagedCompute {
|
|
|
59
60
|
memoryMb: compute.memoryMb,
|
|
60
61
|
regions: compute.regions,
|
|
61
62
|
slots: this.maxRuns,
|
|
63
|
+
gpuKind,
|
|
62
64
|
};
|
|
63
65
|
}
|
|
64
66
|
computeMap[key].actions.push(action);
|
package/package.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
|
|
2
2
|
import { type CallContext, type CallOptions } from 'nice-grpc-common';
|
|
3
3
|
export declare const protobufPackage = "";
|
|
4
|
+
export declare enum SDKS {
|
|
5
|
+
UNKNOWN = 0,
|
|
6
|
+
GO = 1,
|
|
7
|
+
PYTHON = 2,
|
|
8
|
+
TYPESCRIPT = 3,
|
|
9
|
+
UNRECOGNIZED = -1
|
|
10
|
+
}
|
|
11
|
+
export declare function sDKSFromJSON(object: any): SDKS;
|
|
12
|
+
export declare function sDKSToJSON(object: SDKS): string;
|
|
4
13
|
export declare enum ActionType {
|
|
5
14
|
START_STEP_RUN = 0,
|
|
6
15
|
CANCEL_STEP_RUN = 1,
|
|
@@ -59,6 +68,13 @@ export interface WorkerLabels {
|
|
|
59
68
|
strValue?: string | undefined;
|
|
60
69
|
intValue?: number | undefined;
|
|
61
70
|
}
|
|
71
|
+
export interface RuntimeInfo {
|
|
72
|
+
sdkVersion?: string | undefined;
|
|
73
|
+
language?: SDKS | undefined;
|
|
74
|
+
languageVersion?: string | undefined;
|
|
75
|
+
os?: string | undefined;
|
|
76
|
+
extra?: string | undefined;
|
|
77
|
+
}
|
|
62
78
|
export interface WorkerRegisterRequest {
|
|
63
79
|
/** the name of the worker */
|
|
64
80
|
workerName: string;
|
|
@@ -74,6 +90,8 @@ export interface WorkerRegisterRequest {
|
|
|
74
90
|
};
|
|
75
91
|
/** (optional) webhookId is the id of the webhook that the worker is associated with (if any) */
|
|
76
92
|
webhookId?: string | undefined;
|
|
93
|
+
/** (optional) information regarding the runtime environment of the worker */
|
|
94
|
+
runtimeInfo?: RuntimeInfo | undefined;
|
|
77
95
|
}
|
|
78
96
|
export interface WorkerRegisterRequest_LabelsEntry {
|
|
79
97
|
key: string;
|
|
@@ -274,6 +292,7 @@ export interface ReleaseSlotRequest {
|
|
|
274
292
|
export interface ReleaseSlotResponse {
|
|
275
293
|
}
|
|
276
294
|
export declare const WorkerLabels: MessageFns<WorkerLabels>;
|
|
295
|
+
export declare const RuntimeInfo: MessageFns<RuntimeInfo>;
|
|
277
296
|
export declare const WorkerRegisterRequest: MessageFns<WorkerRegisterRequest>;
|
|
278
297
|
export declare const WorkerRegisterRequest_LabelsEntry: MessageFns<WorkerRegisterRequest_LabelsEntry>;
|
|
279
298
|
export declare const WorkerRegisterResponse: MessageFns<WorkerRegisterResponse>;
|