@onesi/genesis 0.0.1-stage → 0.2.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.
Files changed (113) hide show
  1. package/README.md +29 -0
  2. package/dist/auto.d.ts +1010 -0
  3. package/dist/auto.js +125 -0
  4. package/dist/beacons.d.ts +145 -0
  5. package/dist/beacons.js +148 -0
  6. package/dist/blinds-owner-enrollment.d.ts +280 -0
  7. package/dist/blinds-owner-enrollment.js +169 -0
  8. package/dist/client.d.ts +52 -0
  9. package/dist/client.js +384 -0
  10. package/dist/context.d.ts +50 -0
  11. package/dist/context.js +153 -0
  12. package/dist/dials.d.ts +299 -0
  13. package/dist/dials.js +100 -0
  14. package/dist/errors.d.ts +35 -0
  15. package/dist/errors.js +66 -0
  16. package/dist/flares.d.ts +202 -0
  17. package/dist/flares.js +61 -0
  18. package/dist/fleets.d.ts +218 -0
  19. package/dist/fleets.js +189 -0
  20. package/dist/flocks.d.ts +439 -0
  21. package/dist/flocks.js +98 -0
  22. package/dist/foundry-billing.d.ts +97 -0
  23. package/dist/foundry-billing.js +107 -0
  24. package/dist/foundry.d.ts +424 -0
  25. package/dist/foundry.js +133 -0
  26. package/dist/garden.d.ts +754 -0
  27. package/dist/garden.js +76 -0
  28. package/dist/gateway.d.ts +365 -0
  29. package/dist/gateway.js +82 -0
  30. package/dist/gears.d.ts +226 -0
  31. package/dist/gears.js +42 -0
  32. package/dist/generated/operations.d.ts +4 -0
  33. package/dist/generated/operations.js +65134 -0
  34. package/dist/generated/schema.d.ts +87658 -0
  35. package/dist/generated/schema.js +1 -0
  36. package/dist/genesis.d.ts +9574 -0
  37. package/dist/genesis.js +271 -0
  38. package/dist/genesis.openapi.json +128522 -0
  39. package/dist/henry.d.ts +369 -0
  40. package/dist/henry.js +268 -0
  41. package/dist/hives-cells.d.ts +127 -0
  42. package/dist/hives-cells.js +151 -0
  43. package/dist/hives-environment.d.ts +37 -0
  44. package/dist/hives-environment.js +80 -0
  45. package/dist/hives-functions.d.ts +36 -0
  46. package/dist/hives-functions.js +185 -0
  47. package/dist/hives-marketplace.d.ts +128 -0
  48. package/dist/hives-marketplace.js +187 -0
  49. package/dist/hives-node.d.ts +9 -0
  50. package/dist/hives-node.js +155 -0
  51. package/dist/hives-operations.d.ts +451 -0
  52. package/dist/hives-operations.js +43 -0
  53. package/dist/hives-platform.d.ts +149 -0
  54. package/dist/hives-platform.js +183 -0
  55. package/dist/hives-queue-consumer.d.ts +56 -0
  56. package/dist/hives-queue-consumer.js +95 -0
  57. package/dist/hives-queue-funding.d.ts +28 -0
  58. package/dist/hives-queue-funding.js +81 -0
  59. package/dist/hives-queues.d.ts +137 -0
  60. package/dist/hives-queues.js +143 -0
  61. package/dist/hives-resources-transport.d.ts +23 -0
  62. package/dist/hives-resources-transport.js +204 -0
  63. package/dist/hives-response.d.ts +2 -0
  64. package/dist/hives-response.js +32 -0
  65. package/dist/hives-runtimes.d.ts +34 -0
  66. package/dist/hives-runtimes.js +32 -0
  67. package/dist/hives-sse.d.ts +24 -0
  68. package/dist/hives-sse.js +111 -0
  69. package/dist/hives-topics.d.ts +51 -0
  70. package/dist/hives-topics.js +79 -0
  71. package/dist/hives-upload.d.ts +9 -0
  72. package/dist/hives-upload.js +23 -0
  73. package/dist/hives-volumes.d.ts +64 -0
  74. package/dist/hives-volumes.js +117 -0
  75. package/dist/iam-directory.d.ts +8 -0
  76. package/dist/iam-directory.js +23 -0
  77. package/dist/iam.d.ts +391 -0
  78. package/dist/iam.js +92 -0
  79. package/dist/idempotency.d.ts +7 -0
  80. package/dist/idempotency.js +39 -0
  81. package/dist/index.d.ts +47 -0
  82. package/dist/index.js +37 -0
  83. package/dist/instances.d.ts +200 -0
  84. package/dist/instances.js +43 -0
  85. package/dist/lanes.d.ts +267 -0
  86. package/dist/lanes.js +41 -0
  87. package/dist/minds-agent.d.ts +88 -0
  88. package/dist/minds-agent.js +233 -0
  89. package/dist/minds-engine.d.ts +394 -0
  90. package/dist/minds-engine.js +555 -0
  91. package/dist/minds-owner.d.ts +110 -0
  92. package/dist/minds-owner.js +226 -0
  93. package/dist/minds.d.ts +377 -0
  94. package/dist/minds.js +228 -0
  95. package/dist/orgs.d.ts +405 -0
  96. package/dist/orgs.js +63 -0
  97. package/dist/relays-enrollment.d.ts +33 -0
  98. package/dist/relays-enrollment.js +115 -0
  99. package/dist/runner-grant.d.ts +10 -0
  100. package/dist/runner-grant.js +133 -0
  101. package/dist/runner.d.ts +72 -0
  102. package/dist/runner.js +117 -0
  103. package/dist/scopes.d.ts +310 -0
  104. package/dist/scopes.js +40 -0
  105. package/dist/taps.d.ts +118 -0
  106. package/dist/taps.js +45 -0
  107. package/dist/traces.d.ts +574 -0
  108. package/dist/traces.js +97 -0
  109. package/dist/types.d.ts +98 -0
  110. package/dist/types.js +1 -0
  111. package/dist/urls.d.ts +6 -0
  112. package/dist/urls.js +31 -0
  113. package/package.json +49 -1
package/dist/orgs.d.ts ADDED
@@ -0,0 +1,405 @@
1
+ import type { GenesisClient } from './client.js';
2
+ import type { OperationInput as In } from './types.js';
3
+ type Page = {
4
+ after?: number;
5
+ limit?: number;
6
+ };
7
+ type Version = number | string;
8
+ /** A downloaded Orgs document: its bytes, media type and the sha256 the service reported (hex). */
9
+ export interface OrgsDocumentContent {
10
+ bytes: Uint8Array;
11
+ contentType: string;
12
+ sha256: string | null;
13
+ }
14
+ /**
15
+ * Orgs (legal entities): entities, the registered agent, seats, resolutions and votes, documents and
16
+ * signatures, filings, formation rehearsals and the hash-chained record. PATCH, PUT and DELETE take
17
+ * the `version` you read (sent as If-Match); a stale one is a 409. Formation never files or pays.
18
+ */
19
+ export declare function orgsEntitiesModule(client: GenesisClient): {
20
+ whoami: () => Promise<{
21
+ org: string;
22
+ principal: string;
23
+ kind: "api_key" | "m2m_token" | "bridge_session";
24
+ scopes: string[];
25
+ }>;
26
+ portals: () => Promise<{
27
+ data: import("./index.js").components["schemas"]["Orgs.Portal"][];
28
+ }>;
29
+ entities: {
30
+ list: (includeArchived?: boolean) => Promise<{
31
+ data: import("./index.js").components["schemas"]["Orgs.Entity"][];
32
+ }>;
33
+ get: (entity: string) => Promise<{
34
+ id: string;
35
+ legal_name: string;
36
+ kind: import("./index.js").components["schemas"]["Orgs.EntityKind"];
37
+ jurisdiction: string;
38
+ purpose?: string | null;
39
+ management: import("./index.js").components["schemas"]["Orgs.Management"];
40
+ addresses?: import("./index.js").components["schemas"]["Orgs.Addresses"];
41
+ registered_agent?: import("./index.js").components["schemas"]["Orgs.RegisteredAgent"] | null;
42
+ registered_agent_since?: string | null;
43
+ file_number?: string | null;
44
+ formed_on?: string | null;
45
+ auto_org_id?: string | null;
46
+ status: "draft" | "forming" | "formed" | "active" | "suspended" | "dissolved" | "archived";
47
+ version: number;
48
+ created_at?: string;
49
+ updated_at?: string;
50
+ }>;
51
+ create: (body: In<"orgs_create_entity">["body"]) => Promise<{
52
+ id: string;
53
+ legal_name: string;
54
+ kind: import("./index.js").components["schemas"]["Orgs.EntityKind"];
55
+ jurisdiction: string;
56
+ purpose?: string | null;
57
+ management: import("./index.js").components["schemas"]["Orgs.Management"];
58
+ addresses?: import("./index.js").components["schemas"]["Orgs.Addresses"];
59
+ registered_agent?: import("./index.js").components["schemas"]["Orgs.RegisteredAgent"] | null;
60
+ registered_agent_since?: string | null;
61
+ file_number?: string | null;
62
+ formed_on?: string | null;
63
+ auto_org_id?: string | null;
64
+ status: "draft" | "forming" | "formed" | "active" | "suspended" | "dissolved" | "archived";
65
+ version: number;
66
+ created_at?: string;
67
+ updated_at?: string;
68
+ }>;
69
+ update: (entity: string, version: Version, body: In<"orgs_update_entity">["body"]) => Promise<{
70
+ id: string;
71
+ legal_name: string;
72
+ kind: import("./index.js").components["schemas"]["Orgs.EntityKind"];
73
+ jurisdiction: string;
74
+ purpose?: string | null;
75
+ management: import("./index.js").components["schemas"]["Orgs.Management"];
76
+ addresses?: import("./index.js").components["schemas"]["Orgs.Addresses"];
77
+ registered_agent?: import("./index.js").components["schemas"]["Orgs.RegisteredAgent"] | null;
78
+ registered_agent_since?: string | null;
79
+ file_number?: string | null;
80
+ formed_on?: string | null;
81
+ auto_org_id?: string | null;
82
+ status: "draft" | "forming" | "formed" | "active" | "suspended" | "dissolved" | "archived";
83
+ version: number;
84
+ created_at?: string;
85
+ updated_at?: string;
86
+ }>;
87
+ archive: (entity: string, version: Version) => Promise<{
88
+ id: string;
89
+ legal_name: string;
90
+ kind: import("./index.js").components["schemas"]["Orgs.EntityKind"];
91
+ jurisdiction: string;
92
+ purpose?: string | null;
93
+ management: import("./index.js").components["schemas"]["Orgs.Management"];
94
+ addresses?: import("./index.js").components["schemas"]["Orgs.Addresses"];
95
+ registered_agent?: import("./index.js").components["schemas"]["Orgs.RegisteredAgent"] | null;
96
+ registered_agent_since?: string | null;
97
+ file_number?: string | null;
98
+ formed_on?: string | null;
99
+ auto_org_id?: string | null;
100
+ status: "draft" | "forming" | "formed" | "active" | "suspended" | "dissolved" | "archived";
101
+ version: number;
102
+ created_at?: string;
103
+ updated_at?: string;
104
+ }>;
105
+ setRegisteredAgent: (entity: string, version: Version, body: In<"orgs_set_registered_agent">["body"]) => Promise<{
106
+ id: string;
107
+ legal_name: string;
108
+ kind: import("./index.js").components["schemas"]["Orgs.EntityKind"];
109
+ jurisdiction: string;
110
+ purpose?: string | null;
111
+ management: import("./index.js").components["schemas"]["Orgs.Management"];
112
+ addresses?: import("./index.js").components["schemas"]["Orgs.Addresses"];
113
+ registered_agent?: import("./index.js").components["schemas"]["Orgs.RegisteredAgent"] | null;
114
+ registered_agent_since?: string | null;
115
+ file_number?: string | null;
116
+ formed_on?: string | null;
117
+ auto_org_id?: string | null;
118
+ status: "draft" | "forming" | "formed" | "active" | "suspended" | "dissolved" | "archived";
119
+ version: number;
120
+ created_at?: string;
121
+ updated_at?: string;
122
+ }>;
123
+ removeRegisteredAgent: (entity: string, version: Version) => Promise<{
124
+ id: string;
125
+ legal_name: string;
126
+ kind: import("./index.js").components["schemas"]["Orgs.EntityKind"];
127
+ jurisdiction: string;
128
+ purpose?: string | null;
129
+ management: import("./index.js").components["schemas"]["Orgs.Management"];
130
+ addresses?: import("./index.js").components["schemas"]["Orgs.Addresses"];
131
+ registered_agent?: import("./index.js").components["schemas"]["Orgs.RegisteredAgent"] | null;
132
+ registered_agent_since?: string | null;
133
+ file_number?: string | null;
134
+ formed_on?: string | null;
135
+ auto_org_id?: string | null;
136
+ status: "draft" | "forming" | "formed" | "active" | "suspended" | "dissolved" | "archived";
137
+ version: number;
138
+ created_at?: string;
139
+ updated_at?: string;
140
+ }>;
141
+ seats: (entity: string, includeEnded?: boolean) => Promise<{
142
+ data: import("./index.js").components["schemas"]["Orgs.Seat"][];
143
+ }>;
144
+ createSeat: (entity: string, body: In<"orgs_create_seat">["body"]) => Promise<{
145
+ id: string;
146
+ entity_id: string;
147
+ role: import("./index.js").components["schemas"]["Orgs.SeatRole"];
148
+ title?: string | null;
149
+ holder: import("./index.js").components["schemas"]["Orgs.Holder"];
150
+ voting_weight: number;
151
+ status: "active" | "ended";
152
+ started_at?: string | null;
153
+ ended_at?: string | null;
154
+ version: number;
155
+ }>;
156
+ resolutions: (entity: string) => Promise<{
157
+ data: import("./index.js").components["schemas"]["Orgs.Resolution"][];
158
+ }>;
159
+ createResolution: (entity: string, body: In<"orgs_create_resolution">["body"]) => Promise<{
160
+ id: string;
161
+ entity_id: string;
162
+ body_kind: "board" | "members" | "managers";
163
+ title: string;
164
+ text: string;
165
+ votes: import("./index.js").components["schemas"]["Orgs.Vote"][];
166
+ status: "draft" | "adopted" | "rejected" | "withdrawn";
167
+ decided_at?: string | null;
168
+ version: number;
169
+ }>;
170
+ documents: (entity: string, kind?: In<"orgs_list_documents">["kind"]) => Promise<{
171
+ data: import("./index.js").components["schemas"]["Orgs.Document"][];
172
+ }>;
173
+ addDocument: (entity: string, body: In<"orgs_add_document">["body"]) => Promise<{
174
+ id: string;
175
+ entity_id: string;
176
+ kind: import("./index.js").components["schemas"]["Orgs.DocumentKind"];
177
+ title: string;
178
+ media_type: string;
179
+ bytes: number;
180
+ sha256: string;
181
+ storage?: {
182
+ kind?: "gcs" | "boxes";
183
+ file_id?: string;
184
+ };
185
+ source?: string | null;
186
+ signatures?: import("./index.js").components["schemas"]["Orgs.Signature"][];
187
+ created_by?: string;
188
+ created_at?: string;
189
+ }>;
190
+ filings: (entity: string) => Promise<{
191
+ data: import("./index.js").components["schemas"]["Orgs.Filing"][];
192
+ }>;
193
+ createFiling: (entity: string, body: In<"orgs_create_filing">["body"]) => Promise<{
194
+ id: string;
195
+ entity_id: string;
196
+ kind: import("./index.js").components["schemas"]["Orgs.FilingKind"];
197
+ jurisdiction?: string;
198
+ status: "draft" | "prepared" | "ready_to_submit" | "submitted" | "accepted" | "rejected" | "cancelled";
199
+ due_on?: string | null;
200
+ packet?: Record<string, never> | null;
201
+ fee?: unknown;
202
+ receipt?: unknown;
203
+ job_id?: string | null;
204
+ version: number;
205
+ }>;
206
+ /** Prepare the formation packet and queue a rehearsal run (202), or with `dry_run: true` only build the packet (200). */
207
+ requestFormation: (entity: string, body: In<"orgs_request_formation">["body"]) => Promise<{
208
+ packet: import("./index.js").components["schemas"]["Orgs.FormationPacket"];
209
+ }>;
210
+ formationJobs: (entity: string) => Promise<{
211
+ data: import("./index.js").components["schemas"]["Orgs.FormationJob"][];
212
+ }>;
213
+ record: (entity: string, page?: Page) => Promise<{
214
+ data: import("./index.js").components["schemas"]["Orgs.RecordEntry"][];
215
+ next_after?: number | null;
216
+ }>;
217
+ verifyRecord: (entity: string) => Promise<{
218
+ ok: boolean;
219
+ entries: number;
220
+ head?: string | null;
221
+ broken_at?: number | null;
222
+ }>;
223
+ };
224
+ seats: {
225
+ get: (seat: string) => Promise<{
226
+ id: string;
227
+ entity_id: string;
228
+ role: import("./index.js").components["schemas"]["Orgs.SeatRole"];
229
+ title?: string | null;
230
+ holder: import("./index.js").components["schemas"]["Orgs.Holder"];
231
+ voting_weight: number;
232
+ status: "active" | "ended";
233
+ started_at?: string | null;
234
+ ended_at?: string | null;
235
+ version: number;
236
+ }>;
237
+ update: (seat: string, version: Version, body: In<"orgs_update_seat">["body"]) => Promise<{
238
+ id: string;
239
+ entity_id: string;
240
+ role: import("./index.js").components["schemas"]["Orgs.SeatRole"];
241
+ title?: string | null;
242
+ holder: import("./index.js").components["schemas"]["Orgs.Holder"];
243
+ voting_weight: number;
244
+ status: "active" | "ended";
245
+ started_at?: string | null;
246
+ ended_at?: string | null;
247
+ version: number;
248
+ }>;
249
+ end: (seat: string, version: Version) => Promise<{
250
+ id: string;
251
+ entity_id: string;
252
+ role: import("./index.js").components["schemas"]["Orgs.SeatRole"];
253
+ title?: string | null;
254
+ holder: import("./index.js").components["schemas"]["Orgs.Holder"];
255
+ voting_weight: number;
256
+ status: "active" | "ended";
257
+ started_at?: string | null;
258
+ ended_at?: string | null;
259
+ version: number;
260
+ }>;
261
+ };
262
+ resolutions: {
263
+ get: (resolution: string) => Promise<{
264
+ id: string;
265
+ entity_id: string;
266
+ body_kind: "board" | "members" | "managers";
267
+ title: string;
268
+ text: string;
269
+ votes: import("./index.js").components["schemas"]["Orgs.Vote"][];
270
+ status: "draft" | "adopted" | "rejected" | "withdrawn";
271
+ decided_at?: string | null;
272
+ version: number;
273
+ }>;
274
+ vote: (resolution: string, body: In<"orgs_vote">["body"]) => Promise<{
275
+ id: string;
276
+ entity_id: string;
277
+ body_kind: "board" | "members" | "managers";
278
+ title: string;
279
+ text: string;
280
+ votes: import("./index.js").components["schemas"]["Orgs.Vote"][];
281
+ status: "draft" | "adopted" | "rejected" | "withdrawn";
282
+ decided_at?: string | null;
283
+ version: number;
284
+ }>;
285
+ };
286
+ documents: {
287
+ get: (document: string) => Promise<{
288
+ id: string;
289
+ entity_id: string;
290
+ kind: import("./index.js").components["schemas"]["Orgs.DocumentKind"];
291
+ title: string;
292
+ media_type: string;
293
+ bytes: number;
294
+ sha256: string;
295
+ storage?: {
296
+ kind?: "gcs" | "boxes";
297
+ file_id?: string;
298
+ };
299
+ source?: string | null;
300
+ signatures?: import("./index.js").components["schemas"]["Orgs.Signature"][];
301
+ created_by?: string;
302
+ created_at?: string;
303
+ }>;
304
+ /** The document's raw bytes, its content type and the sha256 the service reported. */
305
+ content: (document: string, init?: {
306
+ signal?: AbortSignal;
307
+ }) => Promise<OrgsDocumentContent>;
308
+ sign: (document: string, body: In<"orgs_sign_document">["body"]) => Promise<{
309
+ id: string;
310
+ entity_id: string;
311
+ kind: import("./index.js").components["schemas"]["Orgs.DocumentKind"];
312
+ title: string;
313
+ media_type: string;
314
+ bytes: number;
315
+ sha256: string;
316
+ storage?: {
317
+ kind?: "gcs" | "boxes";
318
+ file_id?: string;
319
+ };
320
+ source?: string | null;
321
+ signatures?: import("./index.js").components["schemas"]["Orgs.Signature"][];
322
+ created_by?: string;
323
+ created_at?: string;
324
+ }>;
325
+ };
326
+ filings: {
327
+ get: (filing: string) => Promise<{
328
+ id: string;
329
+ entity_id: string;
330
+ kind: import("./index.js").components["schemas"]["Orgs.FilingKind"];
331
+ jurisdiction?: string;
332
+ status: "draft" | "prepared" | "ready_to_submit" | "submitted" | "accepted" | "rejected" | "cancelled";
333
+ due_on?: string | null;
334
+ packet?: Record<string, never> | null;
335
+ fee?: unknown;
336
+ receipt?: unknown;
337
+ job_id?: string | null;
338
+ version: number;
339
+ }>;
340
+ update: (filing: string, version: Version, body: In<"orgs_update_filing">["body"]) => Promise<{
341
+ id: string;
342
+ entity_id: string;
343
+ kind: import("./index.js").components["schemas"]["Orgs.FilingKind"];
344
+ jurisdiction?: string;
345
+ status: "draft" | "prepared" | "ready_to_submit" | "submitted" | "accepted" | "rejected" | "cancelled";
346
+ due_on?: string | null;
347
+ packet?: Record<string, never> | null;
348
+ fee?: unknown;
349
+ receipt?: unknown;
350
+ job_id?: string | null;
351
+ version: number;
352
+ }>;
353
+ };
354
+ formationJobs: {
355
+ get: (job: string) => Promise<{
356
+ id: string;
357
+ entity_id: string;
358
+ filing_id?: string | null;
359
+ portal?: string;
360
+ mode?: "rehearsal";
361
+ runtime?: {
362
+ kind?: "panes" | "rigs" | "shells";
363
+ instance_id?: string | null;
364
+ };
365
+ model?: string | null;
366
+ status: "queued" | "running" | "stopped_at_submit" | "needs_attention" | "failed" | "cancelled";
367
+ stop_reason?: string | null;
368
+ error?: unknown;
369
+ turns?: number;
370
+ actions?: number;
371
+ usage?: unknown;
372
+ requested_by?: string;
373
+ started_at?: string | null;
374
+ finished_at?: string | null;
375
+ version?: number;
376
+ }>;
377
+ steps: (job: string, page?: Page) => Promise<{
378
+ data: import("./index.js").components["schemas"]["Orgs.FormationStep"][];
379
+ next_after?: number | null;
380
+ }>;
381
+ cancel: (job: string) => Promise<{
382
+ id: string;
383
+ entity_id: string;
384
+ filing_id?: string | null;
385
+ portal?: string;
386
+ mode?: "rehearsal";
387
+ runtime?: {
388
+ kind?: "panes" | "rigs" | "shells";
389
+ instance_id?: string | null;
390
+ };
391
+ model?: string | null;
392
+ status: "queued" | "running" | "stopped_at_submit" | "needs_attention" | "failed" | "cancelled";
393
+ stop_reason?: string | null;
394
+ error?: unknown;
395
+ turns?: number;
396
+ actions?: number;
397
+ usage?: unknown;
398
+ requested_by?: string;
399
+ started_at?: string | null;
400
+ finished_at?: string | null;
401
+ version?: number;
402
+ }>;
403
+ };
404
+ };
405
+ export {};
package/dist/orgs.js ADDED
@@ -0,0 +1,63 @@
1
+ import { ifMatchHeaders } from './idempotency.js';
2
+ /**
3
+ * Orgs (legal entities): entities, the registered agent, seats, resolutions and votes, documents and
4
+ * signatures, filings, formation rehearsals and the hash-chained record. PATCH, PUT and DELETE take
5
+ * the `version` you read (sent as If-Match); a stale one is a 409. Formation never files or pays.
6
+ */
7
+ export function orgsEntitiesModule(client) {
8
+ const guarded = (id, input, version) => client.request(id, input, { headers: ifMatchHeaders(id, version) });
9
+ return {
10
+ whoami: () => client.request('orgs_whoami'),
11
+ portals: () => client.request('orgs_list_portals'),
12
+ entities: {
13
+ list: (includeArchived) => client.request('orgs_list_entities', includeArchived === undefined ? {} : { include_archived: includeArchived }),
14
+ get: (entity) => client.request('orgs_get_entity', { entity }),
15
+ create: (body) => client.request('orgs_create_entity', { body }),
16
+ update: (entity, version, body) => guarded('orgs_update_entity', { entity, body }, version),
17
+ archive: (entity, version) => guarded('orgs_archive_entity', { entity }, version),
18
+ setRegisteredAgent: (entity, version, body) => guarded('orgs_set_registered_agent', { entity, body }, version),
19
+ removeRegisteredAgent: (entity, version) => guarded('orgs_remove_registered_agent', { entity }, version),
20
+ seats: (entity, includeEnded) => client.request('orgs_list_seats', includeEnded === undefined ? { entity } : { entity, include_ended: includeEnded }),
21
+ createSeat: (entity, body) => client.request('orgs_create_seat', { entity, body }),
22
+ resolutions: (entity) => client.request('orgs_list_resolutions', { entity }),
23
+ createResolution: (entity, body) => client.request('orgs_create_resolution', { entity, body }),
24
+ documents: (entity, kind) => client.request('orgs_list_documents', kind ? { entity, kind } : { entity }),
25
+ addDocument: (entity, body) => client.request('orgs_add_document', { entity, body }),
26
+ filings: (entity) => client.request('orgs_list_filings', { entity }),
27
+ createFiling: (entity, body) => client.request('orgs_create_filing', { entity, body }),
28
+ /** Prepare the formation packet and queue a rehearsal run (202), or with `dry_run: true` only build the packet (200). */
29
+ requestFormation: (entity, body) => client.request('orgs_request_formation', { entity, body }),
30
+ formationJobs: (entity) => client.request('orgs_list_formation_jobs', { entity }),
31
+ record: (entity, page = {}) => client.request('orgs_get_record', { entity, ...page }),
32
+ verifyRecord: (entity) => client.request('orgs_verify_record', { entity }),
33
+ },
34
+ seats: {
35
+ get: (seat) => client.request('orgs_get_seat', { seat }),
36
+ update: (seat, version, body) => guarded('orgs_update_seat', { seat, body }, version),
37
+ end: (seat, version) => guarded('orgs_end_seat', { seat }, version),
38
+ },
39
+ resolutions: {
40
+ get: (resolution) => client.request('orgs_get_resolution', { resolution }),
41
+ vote: (resolution, body) => client.request('orgs_vote', { resolution, body }),
42
+ },
43
+ documents: {
44
+ get: (document) => client.request('orgs_get_document', { document }),
45
+ /** The document's raw bytes, its content type and the sha256 the service reported. */
46
+ content: async (document, init = {}) => {
47
+ const res = await client.raw('orgs_get_document_content', { document }, init);
48
+ return { bytes: new Uint8Array(await res.arrayBuffer()), contentType: res.headers.get('content-type') ?? 'application/octet-stream',
49
+ sha256: res.headers.get('x-content-sha256') };
50
+ },
51
+ sign: (document, body) => client.request('orgs_sign_document', { document, body }),
52
+ },
53
+ filings: {
54
+ get: (filing) => client.request('orgs_get_filing', { filing }),
55
+ update: (filing, version, body) => guarded('orgs_update_filing', { filing, body }, version),
56
+ },
57
+ formationJobs: {
58
+ get: (job) => client.request('orgs_get_formation_job', { job }),
59
+ steps: (job, page = {}) => client.request('orgs_list_formation_steps', { job, ...page }),
60
+ cancel: (job) => client.request('orgs_cancel_formation_job', { job }),
61
+ },
62
+ };
63
+ }
@@ -0,0 +1,33 @@
1
+ import type { GenesisClient } from './client.js';
2
+ export declare const isRelaysEnrollmentOperation: (id: string) => id is "relays_getEnrollment" | "relays_enroll";
3
+ /** Read status or send one explicit bodyless enrollment. No inferred tenant or mutation replay. */
4
+ export declare function relaysEnrollmentTransport(options: {
5
+ operationId: string;
6
+ input: Record<string, unknown>;
7
+ routing: string;
8
+ url: string;
9
+ credential: () => Promise<string | undefined>;
10
+ fetch: typeof fetch;
11
+ signal?: AbortSignal;
12
+ }): Promise<Response>;
13
+ export declare function relaysEnrollment(client: GenesisClient): {
14
+ get: (options?: {
15
+ signal?: AbortSignal;
16
+ }) => Promise<{
17
+ state: "ready" | "not_enrolled";
18
+ organizationId: string;
19
+ projectId: string;
20
+ workspaceId: string;
21
+ resourceEnvironment: "sandbox";
22
+ }>;
23
+ activate: (options?: {
24
+ signal?: AbortSignal;
25
+ }) => Promise<{
26
+ state: "ready";
27
+ organizationId: string;
28
+ projectId: string;
29
+ workspaceId: string;
30
+ resourceEnvironment: "sandbox";
31
+ created: boolean;
32
+ }>;
33
+ };
@@ -0,0 +1,115 @@
1
+ import { GenesisError } from './errors.js';
2
+ export const isRelaysEnrollmentOperation = (id) => id === 'relays_getEnrollment' || id === 'relays_enroll';
3
+ const nativeId = (value, prefix) => typeof value === 'string'
4
+ && value.startsWith(prefix) && /^[A-Za-z0-9_-]{1,128}$/.test(value.slice(prefix.length));
5
+ /** Read status or send one explicit bodyless enrollment. No inferred tenant or mutation replay. */
6
+ export async function relaysEnrollmentTransport(options) {
7
+ const write = options.operationId === 'relays_enroll';
8
+ const error = (status, type) => new GenesisError({ status, type, operationId: options.operationId,
9
+ message: 'Relays enrollment was not confirmed. Read enrollment status before explicitly trying another activation.' });
10
+ if (options.routing !== 'gateway' || !options.input || typeof options.input !== 'object'
11
+ || Array.isArray(options.input) || Object.keys(options.input).length)
12
+ throw error(0, 'invalid_request');
13
+ const controller = new AbortController();
14
+ const cancel = () => controller.abort(options.signal?.reason);
15
+ options.signal?.addEventListener('abort', cancel, { once: true });
16
+ if (options.signal?.aborted)
17
+ cancel();
18
+ const timer = setTimeout(() => controller.abort(), 20_000);
19
+ async function bounded(promise) {
20
+ controller.signal.throwIfAborted();
21
+ let abort = () => { };
22
+ try {
23
+ return await Promise.race([promise, new Promise((_, reject) => {
24
+ abort = () => reject(error(0, 'transport_error'));
25
+ controller.signal.addEventListener('abort', abort, { once: true });
26
+ })]);
27
+ }
28
+ finally {
29
+ controller.signal.removeEventListener('abort', abort);
30
+ }
31
+ }
32
+ try {
33
+ controller.signal.throwIfAborted();
34
+ const credential = await bounded(options.credential());
35
+ controller.signal.throwIfAborted();
36
+ if (!credential)
37
+ throw error(401, 'unauthenticated');
38
+ const response = await bounded(options.fetch(options.url, { method: write ? 'POST' : 'GET',
39
+ headers: { authorization: `Bearer ${credential}`, accept: 'application/json' },
40
+ redirect: 'error', cache: 'no-store', signal: controller.signal }).then(response => {
41
+ if (controller.signal.aborted) {
42
+ void response.body?.cancel().catch(() => { });
43
+ throw error(0, 'transport_error');
44
+ }
45
+ return response;
46
+ }));
47
+ if (!(response.status === 200 || write && response.status === 201)) {
48
+ void response.body?.cancel().catch(() => { });
49
+ throw error(response.status, 'enrollment_unconfirmed');
50
+ }
51
+ if (!response.body || !/^application\/json(?:;|$)/i.test(response.headers.get('content-type') ?? '')) {
52
+ void response.body?.cancel().catch(() => { });
53
+ throw error(0, 'invalid_response');
54
+ }
55
+ const reader = response.body.getReader(), chunks = [];
56
+ let size = 0;
57
+ const stop = () => { void reader.cancel().catch(() => { }); };
58
+ controller.signal.addEventListener('abort', stop, { once: true });
59
+ try {
60
+ for (;;) {
61
+ const next = await bounded(reader.read());
62
+ if (next.done)
63
+ break;
64
+ size += next.value.length;
65
+ if (size > 8192)
66
+ throw error(0, 'invalid_response');
67
+ chunks.push(next.value);
68
+ }
69
+ }
70
+ finally {
71
+ controller.signal.removeEventListener('abort', stop);
72
+ stop();
73
+ try {
74
+ reader.releaseLock();
75
+ }
76
+ catch { /* cancelled read */ }
77
+ }
78
+ const bytes = new Uint8Array(size);
79
+ let offset = 0;
80
+ for (const chunk of chunks) {
81
+ bytes.set(chunk, offset);
82
+ offset += chunk.length;
83
+ }
84
+ let value;
85
+ try {
86
+ value = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes));
87
+ }
88
+ catch {
89
+ throw error(0, 'invalid_response');
90
+ }
91
+ const fields = ['state', 'organizationId', 'projectId', 'workspaceId', 'resourceEnvironment', ...(write ? ['created'] : [])];
92
+ if (!value || Array.isArray(value) || Object.keys(value).length !== fields.length || Object.keys(value).some(k => !fields.includes(k))
93
+ || !nativeId(value.organizationId, 'o_') || !nativeId(value.projectId, 'pr_') || !nativeId(value.workspaceId, 'w_')
94
+ || value.resourceEnvironment !== 'sandbox' || !['ready', ...(write ? [] : ['not_enrolled'])].includes(String(value.state))
95
+ || write && value.created !== (response.status === 201))
96
+ throw error(0, 'invalid_response');
97
+ return Response.json(value, { status: response.status, headers: { 'cache-control': 'no-store' } });
98
+ }
99
+ catch (e) {
100
+ if (e instanceof GenesisError)
101
+ throw e;
102
+ throw error(0, 'transport_error');
103
+ }
104
+ finally {
105
+ clearTimeout(timer);
106
+ controller.abort();
107
+ options.signal?.removeEventListener('abort', cancel);
108
+ }
109
+ }
110
+ export function relaysEnrollment(client) {
111
+ return {
112
+ get: (options = {}) => client.request('relays_getEnrollment', {}, options),
113
+ activate: (options = {}) => client.request('relays_enroll', {}, options),
114
+ };
115
+ }
@@ -0,0 +1,10 @@
1
+ import { GenesisError } from './errors.js';
2
+ import type { components } from './generated/schema.js';
3
+ export type RunnerSelfExecutionGrantInput = components['schemas']['Iam.RunnerSelfExecutionGrantRequest'];
4
+ export type RunnerSelfExecutionGrant = components['schemas']['Iam.RunnerSelfExecutionGrant'];
5
+ export declare const RUNNER_SELF_GRANT_OPERATION: "iam_runnerSelfExecutionGrant";
6
+ /** Copy only primitive data descriptors before any asynchronous credential call. */
7
+ export declare function snapshotRunnerSelfGrant(args: Record<string, unknown>, routing: string): RunnerSelfExecutionGrantInput;
8
+ export declare function runnerGrantTransportError(): GenesisError;
9
+ /** A bounded closed response; no arbitrary upstream body reaches CLI or MCP. */
10
+ export declare function runnerGrantResponse(res: Response, input: RunnerSelfExecutionGrantInput): Promise<Response>;