@onesi/genesis 0.0.0-stage → 0.1.13

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.
Files changed (87) hide show
  1. package/README.md +28 -2
  2. package/dist/beacons.d.ts +103 -0
  3. package/dist/beacons.js +77 -0
  4. package/dist/blinds-owner-enrollment.d.ts +171 -0
  5. package/dist/blinds-owner-enrollment.js +150 -0
  6. package/dist/client.d.ts +19996 -0
  7. package/dist/client.js +277 -0
  8. package/dist/context.d.ts +50 -0
  9. package/dist/context.js +153 -0
  10. package/dist/dials.d.ts +299 -0
  11. package/dist/dials.js +100 -0
  12. package/dist/errors.d.ts +35 -0
  13. package/dist/errors.js +66 -0
  14. package/dist/flares.d.ts +170 -0
  15. package/dist/flares.js +56 -0
  16. package/dist/fleets.d.ts +186 -0
  17. package/dist/fleets.js +136 -0
  18. package/dist/flocks.d.ts +155 -0
  19. package/dist/flocks.js +39 -0
  20. package/dist/foundry-billing.d.ts +97 -0
  21. package/dist/foundry-billing.js +107 -0
  22. package/dist/gears.d.ts +107 -0
  23. package/dist/gears.js +20 -0
  24. package/dist/generated/operations.d.ts +19949 -0
  25. package/dist/generated/operations.js +23846 -0
  26. package/dist/generated/schema.d.ts +35413 -0
  27. package/dist/generated/schema.js +1 -0
  28. package/dist/genesis.d.ts +2926 -0
  29. package/dist/genesis.js +206 -0
  30. package/dist/genesis.openapi.json +49321 -0
  31. package/dist/henry.d.ts +168 -0
  32. package/dist/henry.js +45 -0
  33. package/dist/hives-cells.d.ts +127 -0
  34. package/dist/hives-cells.js +151 -0
  35. package/dist/hives-environment.d.ts +28 -0
  36. package/dist/hives-environment.js +58 -0
  37. package/dist/hives-functions.d.ts +36 -0
  38. package/dist/hives-functions.js +185 -0
  39. package/dist/hives-marketplace.d.ts +128 -0
  40. package/dist/hives-marketplace.js +187 -0
  41. package/dist/hives-node.d.ts +9 -0
  42. package/dist/hives-node.js +152 -0
  43. package/dist/hives-operations.d.ts +337 -0
  44. package/dist/hives-operations.js +41 -0
  45. package/dist/hives-queue-consumer.d.ts +56 -0
  46. package/dist/hives-queue-consumer.js +95 -0
  47. package/dist/hives-queue-funding.d.ts +28 -0
  48. package/dist/hives-queue-funding.js +81 -0
  49. package/dist/hives-queues.d.ts +137 -0
  50. package/dist/hives-queues.js +143 -0
  51. package/dist/hives-resources-transport.d.ts +23 -0
  52. package/dist/hives-resources-transport.js +204 -0
  53. package/dist/hives-response.d.ts +2 -0
  54. package/dist/hives-response.js +32 -0
  55. package/dist/hives-runtimes.d.ts +34 -0
  56. package/dist/hives-runtimes.js +32 -0
  57. package/dist/hives-topics.d.ts +51 -0
  58. package/dist/hives-topics.js +79 -0
  59. package/dist/hives-upload.d.ts +9 -0
  60. package/dist/hives-upload.js +23 -0
  61. package/dist/hives-volumes.d.ts +64 -0
  62. package/dist/hives-volumes.js +117 -0
  63. package/dist/idempotency.d.ts +4 -0
  64. package/dist/idempotency.js +17 -0
  65. package/dist/index.d.ts +33 -0
  66. package/dist/index.js +25 -0
  67. package/dist/instances.d.ts +25 -0
  68. package/dist/instances.js +11 -0
  69. package/dist/lanes.d.ts +267 -0
  70. package/dist/lanes.js +41 -0
  71. package/dist/minds-agent.d.ts +60 -0
  72. package/dist/minds-agent.js +190 -0
  73. package/dist/minds-owner.d.ts +110 -0
  74. package/dist/minds-owner.js +226 -0
  75. package/dist/minds.d.ts +269 -0
  76. package/dist/minds.js +193 -0
  77. package/dist/relays-enrollment.d.ts +33 -0
  78. package/dist/relays-enrollment.js +115 -0
  79. package/dist/runner-grant.d.ts +10 -0
  80. package/dist/runner-grant.js +133 -0
  81. package/dist/runner.d.ts +68 -0
  82. package/dist/runner.js +116 -0
  83. package/dist/types.d.ts +87 -0
  84. package/dist/types.js +1 -0
  85. package/dist/urls.d.ts +6 -0
  86. package/dist/urls.js +31 -0
  87. package/package.json +46 -3
@@ -0,0 +1,337 @@
1
+ import type { GenesisClient } from './client.js';
2
+ import type { OperationInput as In } from './types.js';
3
+ /** The original Hives scheduler, settings and measured activity use the same gateway and identity. */
4
+ export declare function hivesOperations(client: GenesisClient): {
5
+ cells: {
6
+ list(project: string, query?: {
7
+ page?: number;
8
+ per_page?: number;
9
+ }, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-cells.js").HivesBucketList>;
10
+ get(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-cells.js").HivesBucket>;
11
+ create(project: string, body: import("./hives-cells.js").HivesCreateBucket, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-cells.js").HivesBucket>;
12
+ remove(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
13
+ id: string;
14
+ success: boolean;
15
+ message: string;
16
+ }>;
17
+ reconcile(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
18
+ bucket: import("./hives-cells.js").HivesBucket;
19
+ outcome: string;
20
+ }>;
21
+ cors: {
22
+ get: (project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<import("./hives-cells.js").HivesCorsRule[]>;
23
+ set: (project: string, id: string, rules: import("./hives-cells.js").HivesCorsRule[], options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<import("./hives-cells.js").HivesCorsRule[]>;
24
+ };
25
+ objects: {
26
+ list(project: string, id: string, query?: {
27
+ prefix?: string;
28
+ delimiter?: string;
29
+ continuation_token?: string;
30
+ max_keys?: number;
31
+ }, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-cells.js").HivesObjectList>;
32
+ put(project: string, id: string, key: string, bytes: Blob | ArrayBuffer | ArrayBufferView, options?: import("./hives-resources-transport.js").HivesResourceOptions & {
33
+ content_type?: string;
34
+ }): Promise<import("./hives-cells.js").HivesObjectAcknowledgement>;
35
+ remove: (project: string, id: string, key: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<void>;
36
+ download: (project: string, id: string, key: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<Response>;
37
+ putFlat(project: string, id: string, key: string, bytes: Blob | ArrayBuffer | ArrayBufferView, options?: import("./hives-resources-transport.js").HivesResourceOptions & {
38
+ content_type?: string;
39
+ }): Promise<import("./hives-cells.js").HivesObjectAcknowledgement>;
40
+ removeFlat: (project: string, id: string, key: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<void>;
41
+ };
42
+ presign(project: string, id: string, body: import("./hives-cells.js").HivesPresign, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-cells.js").HivesPresignedUrl>;
43
+ };
44
+ queues: {
45
+ consumer: {
46
+ get(project: string, queue: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queue-consumer.js").HivesQueueConsumerStatus>;
47
+ configure(project: string, queue: string, input: import("./hives-queue-consumer.js").HivesQueueConsumerConfig, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queue-consumer.js").HivesQueueConsumerBinding>;
48
+ remove(project: string, queue: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
49
+ success: true;
50
+ queueId: string;
51
+ }>;
52
+ };
53
+ list(project: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
54
+ data: import("./hives-queues.js").HivesQueue[];
55
+ engine_available: true;
56
+ }>;
57
+ get(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queues.js").HivesQueue>;
58
+ create(project: string, body: import("./hives-queues.js").HivesQueueCreate, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queues.js").HivesQueue>;
59
+ configure(project: string, id: string, body: import("./hives-queues.js").HivesQueueConfig, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queues.js").HivesQueue>;
60
+ remove(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
61
+ deleted: true;
62
+ }>;
63
+ stats(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queues.js").HivesQueue>;
64
+ consumers: (project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<never>;
65
+ pause(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queues.js").HivesQueue>;
66
+ resume(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queues.js").HivesQueue>;
67
+ purge(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
68
+ purged: number;
69
+ }>;
70
+ send(project: string, id: string, body: import("./hives-queues.js").HivesQueueSend, options?: import("./hives-queue-funding.js").HivesQueueSendOptions): Promise<import("./hives-queue-funding.js").HivesQueueOperation | {
71
+ message_id: string;
72
+ }>;
73
+ operations: {
74
+ get(project: string, id: string, operationId: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queue-funding.js").HivesQueueOperation>;
75
+ };
76
+ receive(project: string, id: string, body?: {
77
+ maxMessages?: number;
78
+ waitSeconds?: number;
79
+ }, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
80
+ messages: import("./hives-queues.js").HivesQueueDelivery[];
81
+ }>;
82
+ ack: (project: string, id: string, message: string, receipt: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<{
83
+ acknowledged: boolean;
84
+ released: boolean;
85
+ }>;
86
+ nack: (project: string, id: string, message: string, receipt: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<{
87
+ acknowledged: boolean;
88
+ released: boolean;
89
+ }>;
90
+ deadLetters: (project: string, id: string, query?: {
91
+ limit?: number;
92
+ offset?: number;
93
+ }, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<{
94
+ messages: import("./hives-queues.js").HivesDeadLetter[];
95
+ }>;
96
+ deadLetterStats: (project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<import("./hives-queues.js").HivesDeadLetterStats>;
97
+ replay(project: string, id: string, message: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
98
+ message_id: string;
99
+ replayed: 1;
100
+ }>;
101
+ deleteDeadLetter(project: string, id: string, message: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
102
+ deleted: true;
103
+ }>;
104
+ purgeDeadLetters(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
105
+ purged: number;
106
+ }>;
107
+ };
108
+ topics: {
109
+ list(project: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
110
+ data: import("./hives-topics.js").HivesTopic[];
111
+ }>;
112
+ get(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-topics.js").HivesTopic>;
113
+ create(project: string, body: {
114
+ name: string;
115
+ }, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-topics.js").HivesTopic>;
116
+ remove(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
117
+ deleted: true;
118
+ }>;
119
+ subscriptions: {
120
+ list(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
121
+ data: import("./hives-topics.js").HivesTopicSubscription[];
122
+ }>;
123
+ add(project: string, id: string, queueId: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-topics.js").HivesTopicSubscription>;
124
+ remove(project: string, id: string, subscriptionId: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
125
+ deleted: true;
126
+ }>;
127
+ };
128
+ publish(project: string, id: string, body: import("./hives-topics.js").HivesTopicPublish, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-topics.js").HivesTopicPublication>;
129
+ };
130
+ runtimes: {
131
+ list: (options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<{
132
+ runtimes: import("./hives-runtimes.js").HivesRuntime[];
133
+ }>;
134
+ project: (project_id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<{
135
+ runtimes: import("./hives-runtimes.js").HivesRuntime[];
136
+ }>;
137
+ get: (name: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<import("./hives-runtimes.js").HivesRuntime>;
138
+ select: (input: {
139
+ wasi: string;
140
+ runner: string;
141
+ artifact: string;
142
+ }, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<import("./hives-runtimes.js").HivesRuntimeSelection>;
143
+ };
144
+ settings: {
145
+ get: (project_id: string) => Promise<{
146
+ autoDeployEnabled: boolean;
147
+ buildCommand?: string | null;
148
+ defaultRegion: string;
149
+ installCommand?: string | null;
150
+ outputDirectory?: string | null;
151
+ previewDeploymentsEnabled: boolean;
152
+ } & {
153
+ capabilities: import("./index.js").components["schemas"]["Hives.ProjectSettingsCapabilities"];
154
+ effective: import("./index.js").components["schemas"]["Hives.EffectiveProjectSettings"];
155
+ }>;
156
+ update: (project_id: string, body: In<"hives_update_project_settings">["body"]) => Promise<{
157
+ autoDeployEnabled: boolean;
158
+ buildCommand?: string | null;
159
+ defaultRegion: string;
160
+ installCommand?: string | null;
161
+ outputDirectory?: string | null;
162
+ previewDeploymentsEnabled: boolean;
163
+ } & {
164
+ capabilities: import("./index.js").components["schemas"]["Hives.ProjectSettingsCapabilities"];
165
+ effective: import("./index.js").components["schemas"]["Hives.EffectiveProjectSettings"];
166
+ }>;
167
+ };
168
+ crons: {
169
+ list: (project_id: string, q?: Omit<In<"hives_list_crons">, "project_id">) => Promise<Record<string, never>>;
170
+ get: (project_id: string, cron_id: string) => Promise<Record<string, never>>;
171
+ create: (project_id: string, body: In<"hives_create_cron">["body"]) => Promise<Record<string, never>>;
172
+ update: (project_id: string, cron_id: string, body: In<"hives_update_cron">["body"]) => Promise<Record<string, never>>;
173
+ delete: (project_id: string, cron_id: string) => Promise<{
174
+ id: string;
175
+ message: string;
176
+ success: boolean;
177
+ }>;
178
+ pause: (project_id: string, cron_id: string) => Promise<Record<string, never>>;
179
+ resume: (project_id: string, cron_id: string) => Promise<Record<string, never>>;
180
+ /** Admission returns a persisted run ID; read history to learn its actual outcome. No retry. */
181
+ trigger: (project_id: string, cron_id: string) => Promise<unknown>;
182
+ runs: (project_id: string, cron_id: string, q?: Omit<In<"hives_get_cron_runs">, "project_id" | "cron_id">) => Promise<{
183
+ data: {
184
+ duration_ms?: number | null;
185
+ ended_at?: string | null;
186
+ error?: string | null;
187
+ id: string;
188
+ logs_url?: string | null;
189
+ started_at: string;
190
+ status: string;
191
+ }[];
192
+ pagination: import("./index.js").components["schemas"]["Hives.PaginationMeta"];
193
+ }>;
194
+ };
195
+ metrics: {
196
+ project: (project_id: string, q?: Omit<In<"hives_get_project_metrics">, "project_id">) => Promise<{
197
+ active_deployments: number;
198
+ avg_api_http_duration_ms?: number | null;
199
+ avg_response_time_ms?: number | null;
200
+ cron_executions?: number | null;
201
+ data_transfer_bytes: number;
202
+ error_count: number;
203
+ error_rate?: number | null;
204
+ function_invocations: number;
205
+ observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
206
+ observed_request_payload_bytes: number;
207
+ observed_response_payload_bytes: number;
208
+ p95_response_time_ms?: number | null;
209
+ p99_response_time_ms?: number | null;
210
+ project_id: string;
211
+ storage_bytes?: number | null;
212
+ time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
213
+ total_requests: number;
214
+ unique_visitors?: number | null;
215
+ }>;
216
+ dashboard: (project_id: string, q?: Omit<In<"hives_get_dashboard_metrics">, "project_id">) => Promise<{
217
+ activeDeployments: number;
218
+ avgApiHttpDurationMs?: number | null;
219
+ avgLatencyMs?: number | null;
220
+ deploymentsChange?: number | null;
221
+ errorRate?: number | null;
222
+ errorRateChange?: number | null;
223
+ errorTimeSeries: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
224
+ latencyChange?: number | null;
225
+ latencyTimeSeries: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
226
+ observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
227
+ observedRequestPayloadBytes: number;
228
+ observedResponsePayloadBytes: number;
229
+ requestsChange?: number | null;
230
+ requestsTimeSeries: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
231
+ totalRequests: number;
232
+ }>;
233
+ requests: (project_id: string, q?: Omit<In<"hives_get_request_metrics">, "project_id">) => Promise<{
234
+ aggregation: import("./index.js").components["schemas"]["Hives.MetricAggregation"];
235
+ data: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
236
+ name: string;
237
+ observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
238
+ resolution_seconds: number;
239
+ time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
240
+ }>;
241
+ latency: (project_id: string, q?: Omit<In<"hives_get_latency_metrics">, "project_id">) => Promise<{
242
+ aggregation: import("./index.js").components["schemas"]["Hives.MetricAggregation"];
243
+ data: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
244
+ name: string;
245
+ observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
246
+ resolution_seconds: number;
247
+ time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
248
+ }>;
249
+ errors: (project_id: string, q?: Omit<In<"hives_get_error_metrics">, "project_id">) => Promise<{
250
+ aggregation: import("./index.js").components["schemas"]["Hives.MetricAggregation"];
251
+ data: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
252
+ name: string;
253
+ observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
254
+ resolution_seconds: number;
255
+ time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
256
+ }>;
257
+ function: (project_id: string, function_id: string, q?: Omit<In<"hives_get_function_metrics">, "project_id" | "function_id">) => Promise<{
258
+ avg_api_http_duration_ms?: number | null;
259
+ avg_duration_ms?: number | null;
260
+ billed_gb_seconds?: number | null;
261
+ cold_starts?: number | null;
262
+ configured_memory_limit_mb: number;
263
+ failed_invocations: number;
264
+ function_id: string;
265
+ function_name: string;
266
+ memory_mb?: number | null;
267
+ observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
268
+ observed_request_payload_bytes: number;
269
+ observed_response_payload_bytes: number;
270
+ p50_duration_ms?: number | null;
271
+ p95_duration_ms?: number | null;
272
+ p99_duration_ms?: number | null;
273
+ success_rate?: number | null;
274
+ successful_invocations: number;
275
+ time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
276
+ timeouts?: number | null;
277
+ total_invocations: number;
278
+ }>;
279
+ invocations: (project_id: string, function_id: string, q?: Omit<In<"hives_get_function_invocations_series">, "project_id" | "function_id">) => Promise<{
280
+ aggregation: import("./index.js").components["schemas"]["Hives.MetricAggregation"];
281
+ data: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
282
+ name: string;
283
+ observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
284
+ resolution_seconds: number;
285
+ time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
286
+ }>;
287
+ deployment: (project_id: string, deployment_id: string, q?: Omit<In<"hives_get_deployment_metrics">, "project_id" | "deployment_id">) => Promise<{
288
+ active_instances?: number | null;
289
+ avg_api_http_duration_ms?: number | null;
290
+ avg_cpu_percent?: number | null;
291
+ avg_memory_mb?: number | null;
292
+ avg_response_time_ms?: number | null;
293
+ deployment_id: string;
294
+ error_count: number;
295
+ error_rate?: number | null;
296
+ max_instances?: number | null;
297
+ min_instances?: number | null;
298
+ network_in_bytes?: number | null;
299
+ network_out_bytes?: number | null;
300
+ observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
301
+ observed_request_payload_bytes: number;
302
+ observed_response_payload_bytes: number;
303
+ p95_response_time_ms?: number | null;
304
+ time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
305
+ total_requests: number;
306
+ }>;
307
+ resources: (project_id: string, q?: Omit<In<"hives_get_resource_usage">, "project_id">) => Promise<{
308
+ active_deployments: number;
309
+ avg_api_http_duration_ms?: number | null;
310
+ bandwidth_gb?: number | null;
311
+ build_minutes?: number | null;
312
+ compute_gb_seconds?: number | null;
313
+ custom_domains: number;
314
+ function_invocations: number;
315
+ observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
316
+ observed_request_payload_bytes: number;
317
+ observed_response_payload_bytes: number;
318
+ scheduled_jobs: number;
319
+ ssl_certificates: number;
320
+ storage_gb?: number | null;
321
+ time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
322
+ }>;
323
+ realtime: (project_id: string) => Promise<{
324
+ active_connections?: number | null;
325
+ avg_api_http_duration_ms?: number | null;
326
+ avg_response_time_ms?: number | null;
327
+ cpu_percent?: number | null;
328
+ error_rate?: number | null;
329
+ memory_percent?: number | null;
330
+ observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
331
+ observed_request_payload_bytes: number;
332
+ observed_response_payload_bytes: number;
333
+ requests_per_second: number;
334
+ updated_at: string;
335
+ }>;
336
+ };
337
+ };
@@ -0,0 +1,41 @@
1
+ import { hivesTopics } from './hives-topics.js';
2
+ import { hivesCells } from './hives-cells.js';
3
+ import { hivesQueues } from './hives-queues.js';
4
+ import { hivesRuntimes } from './hives-runtimes.js';
5
+ /** The original Hives scheduler, settings and measured activity use the same gateway and identity. */
6
+ export function hivesOperations(client) {
7
+ return {
8
+ cells: hivesCells(client),
9
+ queues: hivesQueues(client),
10
+ topics: hivesTopics(client),
11
+ runtimes: hivesRuntimes(client),
12
+ settings: {
13
+ get: (project_id) => client.request('hives_get_project_settings', { project_id }),
14
+ update: (project_id, body) => client.request('hives_update_project_settings', { project_id, body }),
15
+ },
16
+ crons: {
17
+ list: (project_id, q = {}) => client.request('hives_list_crons', { ...q, project_id }),
18
+ get: (project_id, cron_id) => client.request('hives_get_cron', { project_id, cron_id }),
19
+ create: (project_id, body) => client.request('hives_create_cron', { project_id, body }),
20
+ update: (project_id, cron_id, body) => client.request('hives_update_cron', { project_id, cron_id, body }),
21
+ delete: (project_id, cron_id) => client.request('hives_delete_cron', { project_id, cron_id }),
22
+ pause: (project_id, cron_id) => client.request('hives_pause_cron', { project_id, cron_id }),
23
+ resume: (project_id, cron_id) => client.request('hives_resume_cron', { project_id, cron_id }),
24
+ /** Admission returns a persisted run ID; read history to learn its actual outcome. No retry. */
25
+ trigger: (project_id, cron_id) => client.request('hives_trigger_cron', { project_id, cron_id }),
26
+ runs: (project_id, cron_id, q = {}) => client.request('hives_get_cron_runs', { ...q, project_id, cron_id }),
27
+ },
28
+ metrics: {
29
+ project: (project_id, q = {}) => client.request('hives_get_project_metrics', { ...q, project_id }),
30
+ dashboard: (project_id, q = {}) => client.request('hives_get_dashboard_metrics', { ...q, project_id }),
31
+ requests: (project_id, q = {}) => client.request('hives_get_request_metrics', { ...q, project_id }),
32
+ latency: (project_id, q = {}) => client.request('hives_get_latency_metrics', { ...q, project_id }),
33
+ errors: (project_id, q = {}) => client.request('hives_get_error_metrics', { ...q, project_id }),
34
+ function: (project_id, function_id, q = {}) => client.request('hives_get_function_metrics', { ...q, project_id, function_id }),
35
+ invocations: (project_id, function_id, q = {}) => client.request('hives_get_function_invocations_series', { ...q, project_id, function_id }),
36
+ deployment: (project_id, deployment_id, q = {}) => client.request('hives_get_deployment_metrics', { ...q, project_id, deployment_id }),
37
+ resources: (project_id, q = {}) => client.request('hives_get_resource_usage', { ...q, project_id }),
38
+ realtime: (project_id) => client.request('hives_get_realtime_metrics', { project_id }),
39
+ },
40
+ };
41
+ }
@@ -0,0 +1,56 @@
1
+ import type { GenesisClient } from './client.js';
2
+ import { type HivesResourceOptions } from './hives-resources-transport.js';
3
+ /** Every delivery setting must match the existing standard queue. */
4
+ export interface HivesQueueConsumerConfig {
5
+ functionId: string;
6
+ queueName: string;
7
+ batchSize: 1;
8
+ maxConcurrent: 1;
9
+ visibilityTimeoutSecs: number;
10
+ maxRetries: number;
11
+ deadLetterQueue?: string | null;
12
+ autoAck: true;
13
+ enabled: boolean;
14
+ }
15
+ export interface HivesQueueConsumerBinding {
16
+ queueId: string;
17
+ projectId: string;
18
+ functionId: string;
19
+ enabled: boolean;
20
+ revision: number;
21
+ createdAt: string;
22
+ updatedAt: string;
23
+ }
24
+ export interface HivesQueueConsumerAttempt {
25
+ id: string;
26
+ functionId: string;
27
+ consumerRevision: number;
28
+ messageId: string;
29
+ receiveCount: number;
30
+ status: 'running' | 'succeeded' | 'failed' | 'unconfirmed';
31
+ leaseExpiresAt: string;
32
+ startedAt: string;
33
+ completedAt: string | null;
34
+ executionId: string | null;
35
+ guestStatus: number | null;
36
+ }
37
+ export interface HivesQueueConsumerStatus {
38
+ consumer: {
39
+ binding: HivesQueueConsumerBinding | null;
40
+ latestAttempt: HivesQueueConsumerAttempt | null;
41
+ exhaustedMessages: number;
42
+ };
43
+ /** An operator setting, not evidence that an invocation succeeded. */
44
+ runtimeEnabled: boolean;
45
+ batchSize: 1;
46
+ maxConcurrent: 1;
47
+ autoAck: true;
48
+ }
49
+ export declare function hivesQueueConsumer(client: GenesisClient): {
50
+ get(project: string, queue: string, options?: HivesResourceOptions): Promise<HivesQueueConsumerStatus>;
51
+ configure(project: string, queue: string, input: HivesQueueConsumerConfig, options?: HivesResourceOptions): Promise<HivesQueueConsumerBinding>;
52
+ remove(project: string, queue: string, options?: HivesResourceOptions): Promise<{
53
+ success: true;
54
+ queueId: string;
55
+ }>;
56
+ };
@@ -0,0 +1,95 @@
1
+ import { GenesisError } from './errors.js';
2
+ import { hivesResourceCall, hivesResourceId, resourceError } from './hives-resources-transport.js';
3
+ const badResponse = () => new GenesisError({ status: 0, type: 'invalid_response',
4
+ message: 'Hives returned an invalid or mismatched queue-consumer response. Read saved state before another mutation.' });
5
+ function record(value) {
6
+ if (!value || typeof value !== 'object' || Array.isArray(value))
7
+ throw badResponse();
8
+ return value;
9
+ }
10
+ function id(value) {
11
+ if (typeof value !== 'string' || !/^[A-Za-z0-9_-]{1,128}$/.test(value))
12
+ throw badResponse();
13
+ return value;
14
+ }
15
+ function integer(value, minimum) {
16
+ if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < minimum)
17
+ throw badResponse();
18
+ return value;
19
+ }
20
+ function date(value) {
21
+ if (typeof value !== 'string' || !Number.isFinite(Date.parse(value)))
22
+ throw badResponse();
23
+ return value;
24
+ }
25
+ function binding(value, project, queue) {
26
+ const row = record(value);
27
+ if (row.queueId !== queue || row.projectId !== project || typeof row.enabled !== 'boolean')
28
+ throw badResponse();
29
+ return { queueId: queue, projectId: project, functionId: id(row.functionId), enabled: row.enabled,
30
+ revision: integer(row.revision, 1), createdAt: date(row.createdAt), updatedAt: date(row.updatedAt) };
31
+ }
32
+ function attempt(value) {
33
+ const row = record(value);
34
+ if (!['running', 'succeeded', 'failed', 'unconfirmed'].includes(row.status))
35
+ throw badResponse();
36
+ const confirmed = row.status === 'succeeded' || row.status === 'failed';
37
+ if (confirmed) {
38
+ if (typeof row.executionId !== 'string' || !/^exec_[a-f0-9]{32}$/.test(row.executionId)
39
+ || typeof row.guestStatus !== 'number' || !Number.isInteger(row.guestStatus)
40
+ || row.guestStatus < 200 || row.guestStatus > 599 || row.completedAt === null
41
+ || (row.status === 'succeeded') !== (row.guestStatus < 300))
42
+ throw badResponse();
43
+ }
44
+ else if (row.executionId !== null || row.guestStatus !== null || row.status === 'running' && row.completedAt !== null)
45
+ throw badResponse();
46
+ // History can belong to an earlier function/revision even after the binding is removed.
47
+ return { id: id(row.id), functionId: id(row.functionId), consumerRevision: integer(row.consumerRevision, 1),
48
+ messageId: id(row.messageId), receiveCount: integer(row.receiveCount, 1), status: row.status,
49
+ leaseExpiresAt: date(row.leaseExpiresAt), startedAt: date(row.startedAt),
50
+ completedAt: row.completedAt === null ? null : date(row.completedAt),
51
+ executionId: row.executionId, guestStatus: row.guestStatus };
52
+ }
53
+ function config(value) {
54
+ const allowed = ['functionId', 'queueName', 'batchSize', 'maxConcurrent', 'visibilityTimeoutSecs', 'maxRetries', 'deadLetterQueue', 'autoAck', 'enabled'];
55
+ if (!value || typeof value !== 'object' || Array.isArray(value) || Object.keys(value).some(key => !allowed.includes(key))
56
+ || value.batchSize !== 1 || value.maxConcurrent !== 1 || value.autoAck !== true || typeof value.enabled !== 'boolean'
57
+ || !Number.isInteger(value.visibilityTimeoutSecs) || value.visibilityTimeoutSecs < 75 || value.visibilityTimeoutSecs > 4_294_967_295
58
+ || !Number.isInteger(value.maxRetries) || value.maxRetries < 0 || value.maxRetries > 9)
59
+ throw resourceError(0);
60
+ hivesResourceId(value.functionId);
61
+ hivesResourceId(value.queueName);
62
+ if (value.deadLetterQueue != null)
63
+ hivesResourceId(value.deadLetterQueue);
64
+ return { functionId: value.functionId, queueName: value.queueName, batchSize: 1, maxConcurrent: 1,
65
+ visibilityTimeoutSecs: value.visibilityTimeoutSecs, maxRetries: value.maxRetries,
66
+ deadLetterQueue: value.deadLetterQueue ?? null, autoAck: true, enabled: value.enabled };
67
+ }
68
+ export function hivesQueueConsumer(client) {
69
+ const params = (project, queue) => ({ project_id: hivesResourceId(project), queue_id: hivesResourceId(queue) });
70
+ const call = (operation, input, options) => hivesResourceCall(client, operation, input, options, 'json', 64 * 1024, 20_000, 200);
71
+ return {
72
+ async get(project, queue, options) {
73
+ const row = record(await call('hives_get_native_queue_consumer', params(project, queue), options));
74
+ const status = record(row.consumer);
75
+ if (typeof row.runtimeEnabled !== 'boolean' || row.batchSize !== 1 || row.maxConcurrent !== 1 || row.autoAck !== true)
76
+ throw badResponse();
77
+ return { consumer: { binding: status.binding === null ? null : binding(status.binding, project, queue),
78
+ latestAttempt: status.latestAttempt === null ? null : attempt(status.latestAttempt), exhaustedMessages: integer(status.exhaustedMessages, 0) },
79
+ runtimeEnabled: row.runtimeEnabled, batchSize: 1, maxConcurrent: 1, autoAck: true };
80
+ },
81
+ async configure(project, queue, input, options) {
82
+ const body = config(input);
83
+ const result = binding(await call('hives_configure_native_queue_consumer', { ...params(project, queue), body }, options), project, queue);
84
+ if (result.functionId !== body.functionId || result.enabled !== body.enabled)
85
+ throw badResponse();
86
+ return result;
87
+ },
88
+ async remove(project, queue, options) {
89
+ const result = record(await call('hives_remove_native_queue_consumer', params(project, queue), options));
90
+ if (result.success !== true || result.queueId !== queue)
91
+ throw badResponse();
92
+ return { success: true, queueId: queue };
93
+ },
94
+ };
95
+ }
@@ -0,0 +1,28 @@
1
+ import { GenesisError } from './errors.js';
2
+ export interface HivesQueueSendOptions {
3
+ signal?: AbortSignal;
4
+ idempotencyKey?: string;
5
+ }
6
+ export interface HivesQueueOperation {
7
+ object: 'queue_send_operation';
8
+ operation_id: string;
9
+ state: 'prepared' | 'reserve_unknown' | 'reserved' | 'dispatch_unknown' | 'dispatch_authorized' | 'commit_unknown' | 'settle_unknown' | 'settled' | 'denied' | 'released';
10
+ code: string;
11
+ message_id: string | null;
12
+ funding_source: 'sandbox_allowance' | null;
13
+ reservation_id: string | null;
14
+ native_meter: 'hives.queue_operations';
15
+ quantity_base: string | null;
16
+ upper_bound_quantity_base: string;
17
+ retry_send: false;
18
+ }
19
+ export declare const isHivesQueueFundingOperation: (id: string) => id is "hives_send_native_queue" | "hives_get_operation_native_queue";
20
+ export declare function hivesQueueOperationId(value: unknown): string;
21
+ export declare function hivesQueueSendHeaders(options: HivesQueueSendOptions): Record<string, string>;
22
+ export declare function hivesQueueOperation(value: unknown, expected: unknown): HivesQueueOperation;
23
+ export declare class HivesQueueOperationError extends GenesisError {
24
+ readonly operation: HivesQueueOperation;
25
+ constructor(status: number, operation: HivesQueueOperation);
26
+ }
27
+ /** Only a bounded typed receipt is retained from an error; never an echoed message body. */
28
+ export declare function hivesQueueOperationError(response: Response, expected?: unknown): Promise<HivesQueueOperationError | undefined>;
@@ -0,0 +1,81 @@
1
+ import { GenesisError } from './errors.js';
2
+ export const isHivesQueueFundingOperation = (id) => id === 'hives_send_native_queue' || id === 'hives_get_operation_native_queue';
3
+ export function hivesQueueOperationId(value) {
4
+ if (typeof value !== 'string' || !/^qop_[0-9a-f]{12}7[0-9a-f]{3}[89ab][0-9a-f]{15}$/.test(value))
5
+ throw new Error('Use the original queue operation ID. No send was retried.');
6
+ return value;
7
+ }
8
+ export function hivesQueueSendHeaders(options) {
9
+ if (options.idempotencyKey === undefined)
10
+ return {};
11
+ if (typeof options.idempotencyKey !== 'string' || !/^[ -~]{1,128}$/.test(options.idempotencyKey))
12
+ throw new Error('Use one persisted queue Idempotency-Key of 1–128 printable ASCII bytes.');
13
+ return { 'idempotency-key': options.idempotencyKey };
14
+ }
15
+ export function hivesQueueOperation(value, expected) {
16
+ const operation = hivesQueueOperationId(expected), r = value;
17
+ const keys = ['object', 'operation_id', 'state', 'code', 'message_id', 'funding_source', 'reservation_id', 'native_meter', 'quantity_base', 'upper_bound_quantity_base', 'retry_send'];
18
+ if (!r || typeof r !== 'object' || Array.isArray(r) || Object.keys(r).length !== keys.length || keys.some(k => !Object.hasOwn(r, k))
19
+ || r.object !== 'queue_send_operation' || r.operation_id !== operation || r.retry_send !== false || r.native_meter !== 'hives.queue_operations'
20
+ || !['prepared', 'reserve_unknown', 'reserved', 'dispatch_unknown', 'dispatch_authorized', 'commit_unknown', 'settle_unknown', 'settled', 'denied', 'released'].includes(r.state)
21
+ || typeof r.code !== 'string' || !/^[a-z_]{1,80}$/.test(r.code)
22
+ || r.funding_source !== null && r.funding_source !== 'sandbox_allowance'
23
+ || r.reservation_id !== null && !/^gfr_[A-Za-z0-9_.:@-]{1,124}$/.test(r.reservation_id)
24
+ || r.message_id !== null && !/^msg_[0-9a-f]{12}7[0-9a-f]{3}[89ab][0-9a-f]{15}$/.test(r.message_id)
25
+ || typeof r.upper_bound_quantity_base !== 'string' || !/^[1-5]$/.test(r.upper_bound_quantity_base)
26
+ || r.quantity_base !== null && (typeof r.quantity_base !== 'string' || !/^[1-5]$/.test(r.quantity_base) || Number(r.quantity_base) > Number(r.upper_bound_quantity_base))
27
+ || r.quantity_base !== null && (!r.message_id || !r.reservation_id || !r.funding_source)
28
+ || r.state === 'settled' && (!r.quantity_base || !r.message_id || !r.reservation_id || !r.funding_source)) {
29
+ throw new Error('Queue operation receipt is invalid or mismatched. Retain its original identity; no send was retried.');
30
+ }
31
+ return Object.fromEntries(keys.map(k => [k, r[k]]));
32
+ }
33
+ export class HivesQueueOperationError extends GenesisError {
34
+ operation;
35
+ constructor(status, operation) {
36
+ super({ status, type: 'hives_queue_operation', message: 'Read the original queue operation. Do not retry the send with a new key.', body: operation });
37
+ this.operation = operation;
38
+ }
39
+ }
40
+ /** Only a bounded typed receipt is retained from an error; never an echoed message body. */
41
+ export async function hivesQueueOperationError(response, expected) {
42
+ const id = response.headers.get('x-hives-operation-id');
43
+ try {
44
+ hivesQueueOperationId(id);
45
+ if (expected !== undefined && id !== hivesQueueOperationId(expected))
46
+ return undefined;
47
+ }
48
+ catch {
49
+ return undefined;
50
+ }
51
+ if (!response.body || !response.headers.get('content-type')?.toLowerCase().includes('application/json'))
52
+ return undefined;
53
+ const reader = response.body.getReader(), chunks = [];
54
+ let size = 0;
55
+ try {
56
+ for (;;) {
57
+ const { value, done } = await reader.read();
58
+ if (done)
59
+ break;
60
+ size += value.length;
61
+ if (size > 4096) {
62
+ await reader.cancel();
63
+ return undefined;
64
+ }
65
+ chunks.push(value);
66
+ }
67
+ const bytes = new Uint8Array(size);
68
+ let at = 0;
69
+ for (const chunk of chunks) {
70
+ bytes.set(chunk, at);
71
+ at += chunk.length;
72
+ }
73
+ return new HivesQueueOperationError(response.status, hivesQueueOperation(JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes)), id));
74
+ }
75
+ catch {
76
+ return undefined;
77
+ }
78
+ finally {
79
+ reader.releaseLock();
80
+ }
81
+ }