@pymthouse/builder-sdk 0.0.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -2
- package/dist/client-BHfjDvIe.d.ts +129 -0
- package/dist/client-CvhJEhjV.d.cts +129 -0
- package/dist/config.cjs +122 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +29 -0
- package/dist/config.d.ts +29 -0
- package/dist/config.js +111 -0
- package/dist/config.js.map +1 -0
- package/dist/device-initiate.cjs +88 -0
- package/dist/device-initiate.cjs.map +1 -0
- package/dist/device-initiate.d.cts +32 -0
- package/dist/device-initiate.d.ts +32 -0
- package/dist/device-initiate.js +84 -0
- package/dist/device-initiate.js.map +1 -0
- package/dist/device.cjs +1 -1
- package/dist/device.cjs.map +1 -1
- package/dist/device.d.cts +1 -1
- package/dist/device.d.ts +1 -1
- package/dist/device.js +1 -1
- package/dist/device.js.map +1 -1
- package/dist/env.cjs +1071 -28
- package/dist/env.cjs.map +1 -1
- package/dist/env.d.cts +15 -2
- package/dist/env.d.ts +15 -2
- package/dist/env.js +1071 -28
- package/dist/env.js.map +1 -1
- package/dist/gateway/client/index.cjs +492 -0
- package/dist/gateway/client/index.cjs.map +1 -0
- package/dist/gateway/client/index.d.cts +63 -0
- package/dist/gateway/client/index.d.ts +63 -0
- package/dist/gateway/client/index.js +489 -0
- package/dist/gateway/client/index.js.map +1 -0
- package/dist/gateway/index.cjs +16 -0
- package/dist/gateway/index.cjs.map +1 -0
- package/dist/gateway/index.d.cts +52 -0
- package/dist/gateway/index.d.ts +52 -0
- package/dist/gateway/index.js +10 -0
- package/dist/gateway/index.js.map +1 -0
- package/dist/gateway/server/index.cjs +1248 -0
- package/dist/gateway/server/index.cjs.map +1 -0
- package/dist/gateway/server/index.d.cts +31 -0
- package/dist/gateway/server/index.d.ts +31 -0
- package/dist/gateway/server/index.js +1233 -0
- package/dist/gateway/server/index.js.map +1 -0
- package/dist/index.cjs +1401 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -5
- package/dist/index.d.ts +41 -5
- package/dist/index.js +1334 -105
- package/dist/index.js.map +1 -1
- package/dist/ingest-B3Yi8Tb1.d.cts +271 -0
- package/dist/ingest-DoKJTWU9.d.ts +271 -0
- package/dist/plan-pricing.cjs +108 -0
- package/dist/plan-pricing.cjs.map +1 -0
- package/dist/plan-pricing.d.cts +15 -0
- package/dist/plan-pricing.d.ts +15 -0
- package/dist/plan-pricing.js +98 -0
- package/dist/plan-pricing.js.map +1 -0
- package/dist/signer/server.cjs +1366 -0
- package/dist/signer/server.cjs.map +1 -0
- package/dist/signer/server.d.cts +73 -0
- package/dist/signer/server.d.ts +73 -0
- package/dist/signer/server.js +1331 -0
- package/dist/signer/server.js.map +1 -0
- package/dist/tokens.cjs +75 -0
- package/dist/tokens.cjs.map +1 -0
- package/dist/tokens.d.cts +48 -0
- package/dist/tokens.d.ts +48 -0
- package/dist/tokens.js +64 -0
- package/dist/tokens.js.map +1 -0
- package/dist/types-_R1AwEZp.d.cts +343 -0
- package/dist/types-_R1AwEZp.d.ts +343 -0
- package/dist/verify.cjs +1 -1
- package/dist/verify.cjs.map +1 -1
- package/dist/verify.d.cts +1 -1
- package/dist/verify.d.ts +1 -1
- package/dist/verify.js +1 -1
- package/dist/verify.js.map +1 -1
- package/gateway/proto/lp_rpc.proto +542 -0
- package/package.json +57 -1
- package/dist/env-4YmzarGJ.d.ts +0 -68
- package/dist/env-CZczUMzR.d.cts +0 -68
- package/dist/types-W9PJAspR.d.cts +0 -136
- package/dist/types-W9PJAspR.d.ts +0 -136
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package net;
|
|
4
|
+
option go_package = "./net";
|
|
5
|
+
|
|
6
|
+
// RPC calls implemented by the orchestrator
|
|
7
|
+
service Orchestrator {
|
|
8
|
+
|
|
9
|
+
// Called by the broadcaster to request transcoder info from an orchestrator.
|
|
10
|
+
rpc GetOrchestrator(OrchestratorRequest) returns (OrchestratorInfo);
|
|
11
|
+
rpc EndTranscodingSession(EndTranscodingSessionRequest)
|
|
12
|
+
returns (EndTranscodingSessionResponse);
|
|
13
|
+
rpc Ping(PingPong) returns (PingPong);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
service AIWorker {
|
|
17
|
+
|
|
18
|
+
// Called by the aiworker to register to an orchestrator. The orchestrator
|
|
19
|
+
// notifies registered aiworkers of jobs as they come in.
|
|
20
|
+
rpc RegisterAIWorker(RegisterAIWorkerRequest) returns (stream NotifyAIJob);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
service Transcoder {
|
|
24
|
+
|
|
25
|
+
// Called by the transcoder to register to an orchestrator. The orchestrator
|
|
26
|
+
// notifies registered transcoders of segments as they come in.
|
|
27
|
+
rpc RegisterTranscoder(RegisterRequest) returns (stream NotifySegment);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
message PingPong {
|
|
31
|
+
// Implementation defined
|
|
32
|
+
bytes value = 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// sent by Broadcaster to Orchestrator to terminate the transcoding session and
|
|
36
|
+
// free resources (used for verification sessions)
|
|
37
|
+
message EndTranscodingSessionRequest {
|
|
38
|
+
// Data for transcoding authentication
|
|
39
|
+
AuthToken auth_token = 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
message EndTranscodingSessionResponse {}
|
|
43
|
+
|
|
44
|
+
// This request is sent by the broadcaster in `GetTranscoder` to request
|
|
45
|
+
// information on which transcoder to use.
|
|
46
|
+
message OrchestratorRequest {
|
|
47
|
+
|
|
48
|
+
// Ethereum address of the broadcaster
|
|
49
|
+
bytes address = 1;
|
|
50
|
+
|
|
51
|
+
// Broadcaster's signature over its address
|
|
52
|
+
bytes sig = 2;
|
|
53
|
+
|
|
54
|
+
// Features and constraints required by the broadcaster
|
|
55
|
+
Capabilities capabilities = 3;
|
|
56
|
+
|
|
57
|
+
// Don't throw error in case of missing capacity, used for refreshing session
|
|
58
|
+
// when we don't need to check capacity
|
|
59
|
+
bool ignoreCapacityCheck = 4;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
OSInfo needed to negotiate storages that will be used.
|
|
64
|
+
It carries info needed to write to the storage.
|
|
65
|
+
*/
|
|
66
|
+
message OSInfo {
|
|
67
|
+
|
|
68
|
+
enum StorageType {
|
|
69
|
+
DIRECT = 0;
|
|
70
|
+
S3 = 1;
|
|
71
|
+
GOOGLE = 2;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Storage type: direct, s3, ipfs.
|
|
75
|
+
StorageType storageType = 1;
|
|
76
|
+
|
|
77
|
+
S3OSInfo s3info = 16;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
message S3OSInfo {
|
|
81
|
+
|
|
82
|
+
// Host to use to connect to S3
|
|
83
|
+
string host = 1;
|
|
84
|
+
|
|
85
|
+
// Key (prefix) to use when uploading the object.
|
|
86
|
+
string key = 2;
|
|
87
|
+
|
|
88
|
+
// POST policy that S3 owner node creates to give write access to other node.
|
|
89
|
+
string policy = 3;
|
|
90
|
+
|
|
91
|
+
// Signature for POST policy.
|
|
92
|
+
string signature = 4;
|
|
93
|
+
|
|
94
|
+
// Needed for POST policy.
|
|
95
|
+
string credential = 5;
|
|
96
|
+
|
|
97
|
+
// Needed for POST policy.
|
|
98
|
+
string xAmzDate = 6;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// PriceInfo conveys pricing info for transcoding services
|
|
102
|
+
message PriceInfo {
|
|
103
|
+
// price in wei
|
|
104
|
+
int64 pricePerUnit = 1;
|
|
105
|
+
|
|
106
|
+
// Pixels covered in the price
|
|
107
|
+
// Set price to 1 wei and pixelsPerUnit > 1 to have a smaller price
|
|
108
|
+
// granularity per pixel than 1 wei
|
|
109
|
+
int64 pixelsPerUnit = 2;
|
|
110
|
+
|
|
111
|
+
// Capability price is for
|
|
112
|
+
uint32 capability = 3;
|
|
113
|
+
|
|
114
|
+
// constraint price is for
|
|
115
|
+
string constraint = 4;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
message Capabilities {
|
|
119
|
+
|
|
120
|
+
// Bit string of supported features - one bit per feature
|
|
121
|
+
repeated uint64 bitstring = 1;
|
|
122
|
+
|
|
123
|
+
// Bit string of features that are required to be supported
|
|
124
|
+
repeated uint64 mandatories = 2;
|
|
125
|
+
|
|
126
|
+
// Capacity corresponding to each capability
|
|
127
|
+
map<uint32, uint32> capacities = 3;
|
|
128
|
+
|
|
129
|
+
string version = 4;
|
|
130
|
+
|
|
131
|
+
Constraints constraints = 5;
|
|
132
|
+
|
|
133
|
+
// Non-binary constraints.
|
|
134
|
+
message Constraints {
|
|
135
|
+
string minVersion = 1;
|
|
136
|
+
map<uint32, CapabilityConstraints> PerCapability = 2;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Non-binary capability constraints, such as supported ranges.
|
|
140
|
+
message CapabilityConstraints {
|
|
141
|
+
message ModelConstraint {
|
|
142
|
+
bool warm = 1;
|
|
143
|
+
uint32 capacity = 2;
|
|
144
|
+
string runnerVersion = 3;
|
|
145
|
+
uint32 capacityInUse = 4;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
map<string, ModelConstraint> models = 1;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// The orchestrator sends this in response to `GetOrchestrator`, containing
|
|
153
|
+
// miscellaneous data related to the job.
|
|
154
|
+
message OrchestratorInfo {
|
|
155
|
+
|
|
156
|
+
// URI of the transcoder to use for submitting segments.
|
|
157
|
+
string transcoder = 1;
|
|
158
|
+
|
|
159
|
+
// Parameters for probabilistic micropayment tickets
|
|
160
|
+
TicketParams ticket_params = 2;
|
|
161
|
+
|
|
162
|
+
// Price Info containing the price per pixel to transcode
|
|
163
|
+
PriceInfo price_info = 3;
|
|
164
|
+
|
|
165
|
+
// ETH address that should sign transcoded results
|
|
166
|
+
bytes address = 4;
|
|
167
|
+
|
|
168
|
+
// Features and constraints supported by the orchestrator
|
|
169
|
+
Capabilities capabilities = 5;
|
|
170
|
+
|
|
171
|
+
// Data for transcoding authentication
|
|
172
|
+
AuthToken auth_token = 6;
|
|
173
|
+
|
|
174
|
+
// Information on Orchestrator hardware
|
|
175
|
+
repeated HardwareInformation hardware = 7;
|
|
176
|
+
|
|
177
|
+
// Orchestrator returns info about own input object storage, if it wants it to
|
|
178
|
+
// be used.
|
|
179
|
+
repeated OSInfo storage = 32;
|
|
180
|
+
|
|
181
|
+
// prices for capabilities
|
|
182
|
+
repeated PriceInfo capabilities_prices = 33;
|
|
183
|
+
|
|
184
|
+
// List of other node URIs belonging to this orchestrator.
|
|
185
|
+
repeated string nodes = 34;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Data for transcoding authentication that is included in the OrchestratorInfo
|
|
189
|
+
// message during discovery
|
|
190
|
+
message AuthToken {
|
|
191
|
+
// Record used to authenticate for a transcode session
|
|
192
|
+
// Opaque to the receiver
|
|
193
|
+
bytes token = 1;
|
|
194
|
+
|
|
195
|
+
// ID of the transcode session that the token is authenticating for
|
|
196
|
+
string session_id = 2;
|
|
197
|
+
|
|
198
|
+
// Timestamp when the token expires
|
|
199
|
+
int64 expiration = 3;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Data included by the broadcaster when submitting a segment for transcoding.
|
|
203
|
+
message SegData {
|
|
204
|
+
|
|
205
|
+
// Manifest ID this segment belongs to
|
|
206
|
+
bytes manifestId = 1;
|
|
207
|
+
|
|
208
|
+
// Sequence number of the segment to be transcoded
|
|
209
|
+
int64 seq = 2;
|
|
210
|
+
|
|
211
|
+
// Hash of the segment data to be transcoded
|
|
212
|
+
bytes hash = 3;
|
|
213
|
+
|
|
214
|
+
// Transcoding profiles to use
|
|
215
|
+
bytes profiles = 4;
|
|
216
|
+
|
|
217
|
+
// Broadcaster signature for the segment. Corresponds to:
|
|
218
|
+
// broadcaster.sign(manifestId | seqNo | dataHash | profiles)
|
|
219
|
+
bytes sig = 5;
|
|
220
|
+
|
|
221
|
+
// Duration of the segment to be transcoded, in milliseconds
|
|
222
|
+
int32 duration = 6;
|
|
223
|
+
|
|
224
|
+
// Capabilities used by this segment.
|
|
225
|
+
Capabilities capabilities = 7;
|
|
226
|
+
|
|
227
|
+
// Data for transcoding authentication
|
|
228
|
+
AuthToken auth_token = 8;
|
|
229
|
+
|
|
230
|
+
// Calculate perceptual hash for this segment
|
|
231
|
+
bool calc_perceptual_hash = 10;
|
|
232
|
+
|
|
233
|
+
// Broadcaster's preferred storage medium(s)
|
|
234
|
+
// XXX should we include this in a sig somewhere until certs are
|
|
235
|
+
// authenticated?
|
|
236
|
+
repeated OSInfo storage = 32;
|
|
237
|
+
|
|
238
|
+
// Transcoding profiles to use. Supersedes `profiles` field
|
|
239
|
+
// Deprecated by `fullProfiles2` but may still be used for mpegts formats
|
|
240
|
+
repeated VideoProfile fullProfiles = 33;
|
|
241
|
+
|
|
242
|
+
// Transcoding profiles to use. Supersedes `fullProfiles` field
|
|
243
|
+
// Deprecated by `fullProfiles3` but may still be used for integer FPS
|
|
244
|
+
repeated VideoProfile fullProfiles2 = 34;
|
|
245
|
+
|
|
246
|
+
// Transcoding profiles to use. Supersedes `fullProfiles2` field
|
|
247
|
+
repeated VideoProfile fullProfiles3 = 35;
|
|
248
|
+
|
|
249
|
+
// Transcoding parameters specific to this segment
|
|
250
|
+
SegParameters segment_parameters = 37;
|
|
251
|
+
|
|
252
|
+
// Force HW Session Reinit
|
|
253
|
+
bool ForceSessionReinit = 38;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
message SegParameters {
|
|
257
|
+
// Start timestamp from which to start encoding
|
|
258
|
+
// Milliseconds, from start of the file
|
|
259
|
+
uint64 from = 1;
|
|
260
|
+
// Skip all frames after that timestamp
|
|
261
|
+
// Milliseconds, from start of the file
|
|
262
|
+
uint64 to = 2;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
message VideoProfile {
|
|
266
|
+
// Name of VideoProfile
|
|
267
|
+
string name = 16;
|
|
268
|
+
|
|
269
|
+
// Width of VideoProfile
|
|
270
|
+
int32 width = 17;
|
|
271
|
+
|
|
272
|
+
// Height of VideoProfile
|
|
273
|
+
int32 height = 18;
|
|
274
|
+
|
|
275
|
+
// Bitrate of VideoProfile
|
|
276
|
+
int32 bitrate = 19;
|
|
277
|
+
|
|
278
|
+
// FPS of VideoProfile
|
|
279
|
+
uint32 fps = 20;
|
|
280
|
+
|
|
281
|
+
// Desired output format
|
|
282
|
+
enum Format {
|
|
283
|
+
MPEGTS = 0;
|
|
284
|
+
MP4 = 1;
|
|
285
|
+
}
|
|
286
|
+
Format format = 21;
|
|
287
|
+
|
|
288
|
+
// FPS Denominator of VideoProfile
|
|
289
|
+
uint32 fpsDen = 22;
|
|
290
|
+
|
|
291
|
+
enum Profile {
|
|
292
|
+
ENCODER_DEFAULT = 0;
|
|
293
|
+
H264_BASELINE = 1;
|
|
294
|
+
H264_MAIN = 2;
|
|
295
|
+
H264_HIGH = 3;
|
|
296
|
+
H264_CONSTRAINED_HIGH = 4;
|
|
297
|
+
}
|
|
298
|
+
// Desired codec profile
|
|
299
|
+
Profile profile = 23;
|
|
300
|
+
|
|
301
|
+
// GOP interval
|
|
302
|
+
int32 gop = 24;
|
|
303
|
+
|
|
304
|
+
enum VideoCodec {
|
|
305
|
+
H264 = 0;
|
|
306
|
+
H265 = 1;
|
|
307
|
+
VP8 = 2;
|
|
308
|
+
VP9 = 3;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Encoder (video codec)
|
|
312
|
+
VideoCodec encoder = 25;
|
|
313
|
+
|
|
314
|
+
int32 colorDepth = 26;
|
|
315
|
+
|
|
316
|
+
enum ChromaSubsampling {
|
|
317
|
+
CHROMA_420 = 0;
|
|
318
|
+
CHROMA_422 = 1;
|
|
319
|
+
CHROMA_444 = 2;
|
|
320
|
+
}
|
|
321
|
+
ChromaSubsampling chromaFormat = 27;
|
|
322
|
+
uint32 quality = 28;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// Individual transcoded segment data.
|
|
326
|
+
message TranscodedSegmentData {
|
|
327
|
+
|
|
328
|
+
// URL where the transcoded data can be downloaded from.
|
|
329
|
+
string url = 1;
|
|
330
|
+
|
|
331
|
+
// Amount of pixels processed (output pixels)
|
|
332
|
+
int64 pixels = 2;
|
|
333
|
+
|
|
334
|
+
// URL where the perceptual hash data can be downloaded from (can be empty)
|
|
335
|
+
string perceptual_hash_url = 3;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// A set of transcoded segments following the profiles specified in the job.
|
|
339
|
+
message TranscodeData {
|
|
340
|
+
|
|
341
|
+
// Transcoded data, in the order specified in the job options
|
|
342
|
+
repeated TranscodedSegmentData segments = 1;
|
|
343
|
+
|
|
344
|
+
// Signature of the hash of the concatenated hashes
|
|
345
|
+
bytes sig = 2;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Response that a transcoder sends after transcoding a segment.
|
|
349
|
+
message TranscodeResult {
|
|
350
|
+
|
|
351
|
+
// Sequence number of the transcoded results.
|
|
352
|
+
int64 seq = 1;
|
|
353
|
+
|
|
354
|
+
// Result of transcoding can be an error, or successful with more info
|
|
355
|
+
oneof result {
|
|
356
|
+
string error = 2;
|
|
357
|
+
TranscodeData data = 3;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// Used to notify a broadcaster of updated orchestrator information
|
|
361
|
+
OrchestratorInfo info = 16;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// Response that an orchestrator sends after processing a payment.
|
|
365
|
+
message PaymentResult {
|
|
366
|
+
// Used to notify a broadcaster of updated orchestrator information
|
|
367
|
+
OrchestratorInfo info = 16;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Sent by the transcoder to register itself to the orchestrator.
|
|
371
|
+
message RegisterRequest {
|
|
372
|
+
|
|
373
|
+
// Shared secret for auth
|
|
374
|
+
string secret = 1;
|
|
375
|
+
|
|
376
|
+
// Transcoder capacity
|
|
377
|
+
int64 capacity = 2;
|
|
378
|
+
|
|
379
|
+
// Transcoder capabilities
|
|
380
|
+
Capabilities capabilities = 3;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// Sent by the orchestrator to the transcoder
|
|
384
|
+
message NotifySegment {
|
|
385
|
+
|
|
386
|
+
// URL of the segment to transcode.
|
|
387
|
+
string url = 1;
|
|
388
|
+
|
|
389
|
+
// Configuration for the transcoding job
|
|
390
|
+
SegData segData = 3;
|
|
391
|
+
|
|
392
|
+
// ID for this particular transcoding task.
|
|
393
|
+
int64 taskId = 16;
|
|
394
|
+
|
|
395
|
+
// Orchestrator identifier for segment metadata
|
|
396
|
+
string orchId = 18;
|
|
397
|
+
|
|
398
|
+
// All fields below are deprecated. May still be populated if necessary
|
|
399
|
+
|
|
400
|
+
// Deprecated by segData. Job the segment belongs to.
|
|
401
|
+
reserved 2; // Formerly "string job"
|
|
402
|
+
|
|
403
|
+
// Deprecated by fullProfiles. Set of presets to transcode into.
|
|
404
|
+
// Should be set to an invalid value to induce failures
|
|
405
|
+
bytes profiles = 17;
|
|
406
|
+
|
|
407
|
+
// Deprecated by segData. Transcoding configuration to use.
|
|
408
|
+
reserved 33; // Formerly "repeated VideoProfile fullProfiles"
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// Sent by the aiworker to register itself to the orchestrator.
|
|
412
|
+
message RegisterAIWorkerRequest {
|
|
413
|
+
|
|
414
|
+
// Shared secret for auth
|
|
415
|
+
string secret = 1;
|
|
416
|
+
|
|
417
|
+
// AIWorker capabilities
|
|
418
|
+
Capabilities capabilities = 2;
|
|
419
|
+
|
|
420
|
+
// AIWorker hardware info
|
|
421
|
+
repeated HardwareInformation hardware = 3;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Data included by the gateway when submitting a AI job.
|
|
425
|
+
message AIJobData {
|
|
426
|
+
// pipeline to use for the job
|
|
427
|
+
string pipeline = 1;
|
|
428
|
+
|
|
429
|
+
// AI job request data
|
|
430
|
+
bytes requestData = 2;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// Sent by the orchestrator to the aiworker
|
|
434
|
+
message NotifyAIJob {
|
|
435
|
+
// Configuration for the AI job
|
|
436
|
+
AIJobData AIJobData = 1;
|
|
437
|
+
|
|
438
|
+
// ID for this particular AI task.
|
|
439
|
+
int64 taskId = 2;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// Required parameters for probabilistic micropayment tickets
|
|
443
|
+
message TicketParams {
|
|
444
|
+
// ETH address of the recipient
|
|
445
|
+
bytes recipient = 1;
|
|
446
|
+
|
|
447
|
+
// Pay out (in Wei) to the recipient if the ticket wins
|
|
448
|
+
bytes face_value = 2;
|
|
449
|
+
|
|
450
|
+
// Probability that the ticket wins
|
|
451
|
+
bytes win_prob = 3;
|
|
452
|
+
|
|
453
|
+
// 32 byte keccak-256 hash commitment to a random number provided
|
|
454
|
+
// by the recipient
|
|
455
|
+
bytes recipient_rand_hash = 4;
|
|
456
|
+
|
|
457
|
+
// Value generated by recipient that the recipient can use
|
|
458
|
+
// to derive the random number corresponding to the recipient's hash
|
|
459
|
+
// commitment
|
|
460
|
+
bytes seed = 5;
|
|
461
|
+
|
|
462
|
+
// Block number at which the current set of advertised TicketParams is no
|
|
463
|
+
// longer valid
|
|
464
|
+
bytes expiration_block = 6;
|
|
465
|
+
|
|
466
|
+
// Expected ticket expiration params
|
|
467
|
+
TicketExpirationParams expiration_params = 7;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// Sender Params (nonces and signatures)
|
|
471
|
+
message TicketSenderParams {
|
|
472
|
+
// Monotonically increasing counter that makes the ticket
|
|
473
|
+
// unique relative to a particular hash commitment to a recipient's random
|
|
474
|
+
// number
|
|
475
|
+
uint32 sender_nonce = 1;
|
|
476
|
+
|
|
477
|
+
// Sender signature over the ticket
|
|
478
|
+
bytes sig = 2;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// Ticket params for expiration related validation
|
|
482
|
+
message TicketExpirationParams {
|
|
483
|
+
// Round during which tickets are created
|
|
484
|
+
int64 creation_round = 1;
|
|
485
|
+
|
|
486
|
+
// Block hash associated with creation_round
|
|
487
|
+
bytes creation_round_block_hash = 2;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// Payment for transcoding video segments
|
|
491
|
+
// A payment can constitute of multiple tickets
|
|
492
|
+
// A broadcaster might need to send multiple tickets to top up his credit with
|
|
493
|
+
// an Orchestrator
|
|
494
|
+
message Payment {
|
|
495
|
+
// Probabilistic micropayment ticket parameters
|
|
496
|
+
// These remain the same even when sending multiple tickets
|
|
497
|
+
TicketParams ticket_params = 1;
|
|
498
|
+
|
|
499
|
+
// ETH address of the sender
|
|
500
|
+
bytes sender = 2;
|
|
501
|
+
|
|
502
|
+
// Ticket params for expiration related validation
|
|
503
|
+
TicketExpirationParams expiration_params = 3;
|
|
504
|
+
|
|
505
|
+
repeated TicketSenderParams ticket_sender_params = 4;
|
|
506
|
+
|
|
507
|
+
// O's last known price
|
|
508
|
+
PriceInfo expected_price = 5;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// GPU information used by worker on network
|
|
512
|
+
message GPUComputeInfo {
|
|
513
|
+
// unique id
|
|
514
|
+
string id = 1;
|
|
515
|
+
|
|
516
|
+
// gpu name
|
|
517
|
+
string name = 2;
|
|
518
|
+
|
|
519
|
+
// compute version supported - major
|
|
520
|
+
uint32 major = 4;
|
|
521
|
+
|
|
522
|
+
// compute version supported - minor
|
|
523
|
+
uint32 minor = 5;
|
|
524
|
+
|
|
525
|
+
// GPU memory free
|
|
526
|
+
int64 memory_free = 6;
|
|
527
|
+
|
|
528
|
+
// GPU memory total
|
|
529
|
+
int64 memory_total = 7;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// Hardware information for worker on network
|
|
533
|
+
message HardwareInformation {
|
|
534
|
+
// pipeline hardware supports
|
|
535
|
+
string pipeline = 1;
|
|
536
|
+
|
|
537
|
+
// model_id hardware supports
|
|
538
|
+
string model_id = 2;
|
|
539
|
+
|
|
540
|
+
// hardware for pipeline and model_id
|
|
541
|
+
map<string, GPUComputeInfo> gpu_info = 3;
|
|
542
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pymthouse/builder-sdk",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "PymtHouse Builder API and OIDC client (OpenID-certified oauth4webapi)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
"import": "./dist/index.js",
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
14
|
},
|
|
15
|
+
"./plan-pricing": {
|
|
16
|
+
"types": "./dist/plan-pricing.d.ts",
|
|
17
|
+
"import": "./dist/plan-pricing.js",
|
|
18
|
+
"require": "./dist/plan-pricing.cjs"
|
|
19
|
+
},
|
|
15
20
|
"./format": {
|
|
16
21
|
"types": "./dist/format.d.ts",
|
|
17
22
|
"import": "./dist/format.js",
|
|
@@ -22,22 +27,70 @@
|
|
|
22
27
|
"import": "./dist/env.js",
|
|
23
28
|
"require": "./dist/env.cjs"
|
|
24
29
|
},
|
|
30
|
+
"./config": {
|
|
31
|
+
"types": "./dist/config.d.ts",
|
|
32
|
+
"import": "./dist/config.js",
|
|
33
|
+
"require": "./dist/config.cjs"
|
|
34
|
+
},
|
|
35
|
+
"./tokens": {
|
|
36
|
+
"types": "./dist/tokens.d.ts",
|
|
37
|
+
"import": "./dist/tokens.js",
|
|
38
|
+
"require": "./dist/tokens.cjs"
|
|
39
|
+
},
|
|
25
40
|
"./device": {
|
|
26
41
|
"types": "./dist/device.d.ts",
|
|
27
42
|
"import": "./dist/device.js",
|
|
28
43
|
"require": "./dist/device.cjs"
|
|
29
44
|
},
|
|
45
|
+
"./device-initiate": {
|
|
46
|
+
"types": "./dist/device-initiate.d.ts",
|
|
47
|
+
"import": "./dist/device-initiate.js",
|
|
48
|
+
"require": "./dist/device-initiate.cjs"
|
|
49
|
+
},
|
|
30
50
|
"./verify": {
|
|
31
51
|
"types": "./dist/verify.d.ts",
|
|
32
52
|
"import": "./dist/verify.js",
|
|
33
53
|
"require": "./dist/verify.cjs"
|
|
54
|
+
},
|
|
55
|
+
"./signer/server": {
|
|
56
|
+
"types": "./dist/signer/server.d.ts",
|
|
57
|
+
"import": "./dist/signer/server.js",
|
|
58
|
+
"require": "./dist/signer/server.cjs"
|
|
59
|
+
},
|
|
60
|
+
"./gateway": {
|
|
61
|
+
"types": "./dist/gateway/index.d.ts",
|
|
62
|
+
"import": "./dist/gateway/index.js",
|
|
63
|
+
"require": "./dist/gateway/index.cjs"
|
|
64
|
+
},
|
|
65
|
+
"./gateway/client": {
|
|
66
|
+
"types": "./dist/gateway/client/index.d.ts",
|
|
67
|
+
"import": "./dist/gateway/client/index.js",
|
|
68
|
+
"require": "./dist/gateway/client/index.cjs"
|
|
69
|
+
},
|
|
70
|
+
"./gateway/server": {
|
|
71
|
+
"types": "./dist/gateway/server/index.d.ts",
|
|
72
|
+
"import": "./dist/gateway/server/index.js",
|
|
73
|
+
"require": "./dist/gateway/server/index.cjs"
|
|
34
74
|
}
|
|
35
75
|
},
|
|
36
76
|
"files": [
|
|
37
77
|
"dist",
|
|
78
|
+
"gateway/proto",
|
|
38
79
|
"README.md",
|
|
39
80
|
"LICENSE"
|
|
40
81
|
],
|
|
82
|
+
"peerDependencies": {
|
|
83
|
+
"@grpc/grpc-js": "^1.12.0",
|
|
84
|
+
"@grpc/proto-loader": "^0.7.0"
|
|
85
|
+
},
|
|
86
|
+
"peerDependenciesMeta": {
|
|
87
|
+
"@grpc/grpc-js": {
|
|
88
|
+
"optional": true
|
|
89
|
+
},
|
|
90
|
+
"@grpc/proto-loader": {
|
|
91
|
+
"optional": true
|
|
92
|
+
}
|
|
93
|
+
},
|
|
41
94
|
"sideEffects": false,
|
|
42
95
|
"engines": {
|
|
43
96
|
"node": ">=20"
|
|
@@ -50,6 +103,7 @@
|
|
|
50
103
|
"typecheck": "tsc --noEmit",
|
|
51
104
|
"lint": "eslint .",
|
|
52
105
|
"test": "vitest run",
|
|
106
|
+
"check:gateway-peers": "node scripts/check-gateway-peers.mjs",
|
|
53
107
|
"format": "prettier . --write",
|
|
54
108
|
"format:check": "prettier . --check",
|
|
55
109
|
"prepack": "pnpm run build"
|
|
@@ -58,6 +112,8 @@
|
|
|
58
112
|
"oauth4webapi": "^3.8.5"
|
|
59
113
|
},
|
|
60
114
|
"devDependencies": {
|
|
115
|
+
"@grpc/grpc-js": "^1.14.3",
|
|
116
|
+
"@grpc/proto-loader": "^0.8.0",
|
|
61
117
|
"@eslint/js": "^9.18.0",
|
|
62
118
|
"@types/node": "^22.10.0",
|
|
63
119
|
"eslint": "^9.18.0",
|
package/dist/env-4YmzarGJ.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { f as PmtHouseClientOptions, G as GetDiscoveryOptions, O as OidcDiscoveryDocument, P as ParsedDeviceApprovalRedirect, A as AppUserRecord, g as UpsertAppUserInput, M as MintUserAccessTokenInput, d as MintUserAccessTokenResponse, D as DeviceApprovalInput, T as TokenExchangeResponse, C as ClientCredentialsTokenResponse, e as MintUserSignerSessionTokenInput, h as UsageQueryInput, b as UsageApiResponse } from './types-W9PJAspR.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Normalize RFC 8628 user codes for comparison and resource URIs (uppercase, strip separators).
|
|
5
|
-
*/
|
|
6
|
-
declare function normalizeUserCode(value: string): string;
|
|
7
|
-
/**
|
|
8
|
-
* RFC 8707 resource indicator for NaaP Option B device approval (`urn:pmth:device_code:<normalized>`).
|
|
9
|
-
*/
|
|
10
|
-
declare function buildDeviceCodeResource(userCode: string): string;
|
|
11
|
-
declare class PmtHouseClient {
|
|
12
|
-
private readonly issuerUrl;
|
|
13
|
-
private readonly publicClientId;
|
|
14
|
-
private readonly m2mClientId;
|
|
15
|
-
private readonly m2mClientSecret;
|
|
16
|
-
private readonly fetchImpl;
|
|
17
|
-
private readonly logger?;
|
|
18
|
-
private readonly allowInsecureHttp;
|
|
19
|
-
constructor(options: PmtHouseClientOptions);
|
|
20
|
-
getDiscovery(options?: GetDiscoveryOptions): Promise<OidcDiscoveryDocument>;
|
|
21
|
-
verifyIssuer(iss: string): boolean;
|
|
22
|
-
parseDeviceApprovalRedirect(searchParams: URLSearchParams): ParsedDeviceApprovalRedirect;
|
|
23
|
-
listAppUsers(): Promise<{
|
|
24
|
-
users: AppUserRecord[];
|
|
25
|
-
}>;
|
|
26
|
-
upsertAppUser(input: UpsertAppUserInput): Promise<AppUserRecord>;
|
|
27
|
-
deleteAppUser(params: {
|
|
28
|
-
externalUserId: string;
|
|
29
|
-
}): Promise<{
|
|
30
|
-
success: boolean;
|
|
31
|
-
}>;
|
|
32
|
-
mintUserAccessToken(input: MintUserAccessTokenInput): Promise<MintUserAccessTokenResponse>;
|
|
33
|
-
completeDeviceApproval(input: DeviceApprovalInput): Promise<TokenExchangeResponse>;
|
|
34
|
-
issueMachineAccessToken(scope?: string): Promise<ClientCredentialsTokenResponse>;
|
|
35
|
-
exchangeForSignerSession(input: {
|
|
36
|
-
userJwt: string;
|
|
37
|
-
resource?: string;
|
|
38
|
-
}): Promise<TokenExchangeResponse>;
|
|
39
|
-
/**
|
|
40
|
-
* Mint a short-lived per-user JWT with the Builder API, then exchange it for
|
|
41
|
-
* a long-lived opaque signer session token at the PymtHouse OIDC token endpoint.
|
|
42
|
-
*/
|
|
43
|
-
mintUserSignerSessionToken(input: MintUserSignerSessionTokenInput): Promise<TokenExchangeResponse>;
|
|
44
|
-
createSignerSessionToken(params: {
|
|
45
|
-
userJwt?: string;
|
|
46
|
-
}): Promise<TokenExchangeResponse>;
|
|
47
|
-
getUsage(input?: UsageQueryInput): Promise<UsageApiResponse>;
|
|
48
|
-
private tokenEndpointFetchOptions;
|
|
49
|
-
private getAppsBaseUrl;
|
|
50
|
-
private getIssuerOrigin;
|
|
51
|
-
private builderHeaders;
|
|
52
|
-
private m2mClientAuth;
|
|
53
|
-
private requestJson;
|
|
54
|
-
private safeParseJson;
|
|
55
|
-
private asError;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Site origin for the PymtHouse deployment (e.g. https://pymthouse.com), derived
|
|
60
|
-
* from `PYMTHOUSE_ISSUER_URL`.
|
|
61
|
-
*/
|
|
62
|
-
declare function getPymthouseBaseUrl(): string;
|
|
63
|
-
/**
|
|
64
|
-
* Singleton `PmtHouseClient` from `PYMTHOUSE_*` environment variables (server-side).
|
|
65
|
-
*/
|
|
66
|
-
declare function createPmtHouseClientFromEnv(): PmtHouseClient;
|
|
67
|
-
|
|
68
|
-
export { PmtHouseClient as P, buildDeviceCodeResource as b, createPmtHouseClientFromEnv as c, getPymthouseBaseUrl as g, normalizeUserCode as n };
|