@onesi/genesis 0.1.13 → 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 (69) hide show
  1. package/README.md +1 -1
  2. package/dist/auto.d.ts +1010 -0
  3. package/dist/auto.js +125 -0
  4. package/dist/beacons.d.ts +42 -0
  5. package/dist/beacons.js +71 -0
  6. package/dist/blinds-owner-enrollment.d.ts +109 -0
  7. package/dist/blinds-owner-enrollment.js +21 -2
  8. package/dist/client.d.ts +3 -19947
  9. package/dist/client.js +124 -17
  10. package/dist/errors.js +1 -1
  11. package/dist/flares.d.ts +32 -0
  12. package/dist/flares.js +5 -0
  13. package/dist/fleets.d.ts +32 -0
  14. package/dist/fleets.js +59 -6
  15. package/dist/flocks.d.ts +285 -1
  16. package/dist/flocks.js +59 -0
  17. package/dist/foundry.d.ts +424 -0
  18. package/dist/foundry.js +133 -0
  19. package/dist/garden.d.ts +754 -0
  20. package/dist/garden.js +76 -0
  21. package/dist/gateway.d.ts +365 -0
  22. package/dist/gateway.js +82 -0
  23. package/dist/gears.d.ts +121 -2
  24. package/dist/gears.js +24 -2
  25. package/dist/generated/operations.d.ts +3 -19948
  26. package/dist/generated/operations.js +54590 -13302
  27. package/dist/generated/schema.d.ts +69793 -17548
  28. package/dist/genesis.d.ts +7908 -1260
  29. package/dist/genesis.js +90 -25
  30. package/dist/genesis.openapi.json +109121 -29920
  31. package/dist/henry.d.ts +202 -1
  32. package/dist/henry.js +223 -0
  33. package/dist/hives-environment.d.ts +9 -0
  34. package/dist/hives-environment.js +22 -0
  35. package/dist/hives-node.js +3 -0
  36. package/dist/hives-operations.d.ts +114 -0
  37. package/dist/hives-operations.js +2 -0
  38. package/dist/hives-platform.d.ts +149 -0
  39. package/dist/hives-platform.js +183 -0
  40. package/dist/hives-sse.d.ts +24 -0
  41. package/dist/hives-sse.js +111 -0
  42. package/dist/iam-directory.d.ts +8 -0
  43. package/dist/iam-directory.js +23 -0
  44. package/dist/iam.d.ts +391 -0
  45. package/dist/iam.js +92 -0
  46. package/dist/idempotency.d.ts +3 -0
  47. package/dist/idempotency.js +22 -0
  48. package/dist/index.d.ts +18 -4
  49. package/dist/index.js +16 -4
  50. package/dist/instances.d.ts +177 -2
  51. package/dist/instances.js +37 -5
  52. package/dist/minds-agent.d.ts +28 -0
  53. package/dist/minds-agent.js +53 -10
  54. package/dist/minds-engine.d.ts +394 -0
  55. package/dist/minds-engine.js +555 -0
  56. package/dist/minds.d.ts +109 -1
  57. package/dist/minds.js +49 -14
  58. package/dist/orgs.d.ts +405 -0
  59. package/dist/orgs.js +63 -0
  60. package/dist/runner.d.ts +4 -0
  61. package/dist/runner.js +1 -0
  62. package/dist/scopes.d.ts +310 -0
  63. package/dist/scopes.js +40 -0
  64. package/dist/taps.d.ts +118 -0
  65. package/dist/taps.js +45 -0
  66. package/dist/traces.d.ts +574 -0
  67. package/dist/traces.js +97 -0
  68. package/dist/types.d.ts +12 -1
  69. package/package.json +1 -1
package/dist/iam.d.ts ADDED
@@ -0,0 +1,391 @@
1
+ import type { GenesisClient } from './client.js';
2
+ import type { OperationId } from './generated/operations.js';
3
+ import type { OperationInput } from './types.js';
4
+ type Body<K extends OperationId> = OperationInput<K> extends {
5
+ body?: infer B;
6
+ } ? NonNullable<B> : never;
7
+ type Query<K extends OperationId> = Omit<OperationInput<K>, 'body'>;
8
+ /**
9
+ * IAM v4 tenant operations at /v1/iam/... (iam.l1fe.ai). Use a One account login or an organization API key with iam:read
10
+ * (reads) or iam:write (changes). The gateway exchanges either at Auth for a short-lived IAM token and forwards only that;
11
+ * IAM decides authority (owner or manager for most changes). `org_id` must be your own organization.
12
+ *
13
+ * Inviting members, changing member roles, removing members, Mind API keys and enterprise settings are not here: they stay
14
+ * with a person in the Console. Projects and workspaces are `genesis.projects` and `genesis.workspaces`.
15
+ */
16
+ export declare function iamModule(client: GenesisClient): {
17
+ orgs: {
18
+ list: (query?: Query<"iam_listOrgs">) => Promise<{
19
+ items: import("./index.js").components["schemas"]["Iam.Organization"][];
20
+ next_cursor?: string | null;
21
+ }>;
22
+ get: (org_id: string) => Promise<{
23
+ id: string;
24
+ name: string;
25
+ slug: string;
26
+ owner_human_principal_id?: string;
27
+ metadata?: {
28
+ [key: string]: unknown;
29
+ };
30
+ created_at: number;
31
+ role?: string;
32
+ }>;
33
+ update: (org_id: string, body: Body<"iam_updateOrg">) => Promise<{
34
+ id: string;
35
+ name: string;
36
+ slug: string;
37
+ owner_human_principal_id?: string;
38
+ metadata?: {
39
+ [key: string]: unknown;
40
+ };
41
+ created_at: number;
42
+ role?: string;
43
+ }>;
44
+ members: (org_id: string, query?: Omit<Query<"iam_listMembers">, "org_id">) => Promise<{
45
+ items: import("./index.js").components["schemas"]["Iam.Member"][];
46
+ total?: number;
47
+ nextCursor?: string | null;
48
+ complete?: boolean;
49
+ canManageMembers?: boolean;
50
+ }>;
51
+ entitlements: (org_id: string, environment_id?: "live" | "sandbox") => Promise<{
52
+ items: import("./index.js").components["schemas"]["Iam.Entitlement"][];
53
+ next_cursor?: string | null;
54
+ snapshotVersion?: unknown;
55
+ snapshotGeneratedAt?: unknown;
56
+ snapshotValidUntil?: unknown;
57
+ environmentId?: string;
58
+ }>;
59
+ };
60
+ fleets: {
61
+ list: (org_id: string) => Promise<{
62
+ items: import("./index.js").components["schemas"]["Iam.Fleet"][];
63
+ next_cursor?: string | null;
64
+ }>;
65
+ get: (org_id: string, fleet_id: string) => Promise<{
66
+ id: string;
67
+ organizationId: string;
68
+ projectId?: string;
69
+ workspaceId?: string;
70
+ name: string;
71
+ slug: string;
72
+ metadata?: {
73
+ [key: string]: unknown;
74
+ };
75
+ createdAt: number;
76
+ updatedAt: number;
77
+ }>;
78
+ /** Reuse the same idempotencyKey to replay an uncertain create instead of making a second fleet. */
79
+ create: (org_id: string, body: Body<"iam_createFleet">, idempotencyKey: string) => Promise<{
80
+ id: string;
81
+ organizationId: string;
82
+ projectId?: string;
83
+ workspaceId?: string;
84
+ name: string;
85
+ slug: string;
86
+ metadata?: {
87
+ [key: string]: unknown;
88
+ };
89
+ createdAt: number;
90
+ updatedAt: number;
91
+ }>;
92
+ update: (org_id: string, fleet_id: string, body: Body<"iam_updateFleet">) => Promise<{
93
+ id: string;
94
+ organizationId: string;
95
+ projectId?: string;
96
+ workspaceId?: string;
97
+ name: string;
98
+ slug: string;
99
+ metadata?: {
100
+ [key: string]: unknown;
101
+ };
102
+ createdAt: number;
103
+ updatedAt: number;
104
+ }>;
105
+ /** Permanent; IAM refuses while grants reference the fleet. */
106
+ delete: (org_id: string, fleet_id: string) => Promise<void>;
107
+ };
108
+ agents: {
109
+ list: (org_id: string) => Promise<{
110
+ items: import("./index.js").components["schemas"]["Iam.Agent"][];
111
+ next_cursor?: string | null;
112
+ agents?: import("./index.js").components["schemas"]["Iam.Agent"][];
113
+ }>;
114
+ get: (org_id: string, agent_did: string) => Promise<{
115
+ agent: import("./index.js").components["schemas"]["Iam.Agent"];
116
+ }>;
117
+ /** Without `publicKey` IAM generates a key pair and returns `privateKey` once. */
118
+ create: (org_id: string, body: Body<"iam_createAgent">) => Promise<{
119
+ agent: import("./index.js").components["schemas"]["Iam.Agent"];
120
+ did: string;
121
+ publicKey?: string | null;
122
+ privateKey?: string | null;
123
+ }>;
124
+ /** Revokes the agent (status `revoked`); the record stays. */
125
+ delete: (org_id: string, agent_did: string) => Promise<{
126
+ agent: import("./index.js").components["schemas"]["Iam.Agent"];
127
+ }>;
128
+ suspend: (org_id: string, agent_did: string) => Promise<{
129
+ agent: import("./index.js").components["schemas"]["Iam.Agent"];
130
+ }>;
131
+ resume: (org_id: string, agent_did: string) => Promise<{
132
+ agent: import("./index.js").components["schemas"]["Iam.Agent"];
133
+ }>;
134
+ rotate: (org_id: string, agent_did: string, body?: Body<"iam_rotateAgentKey">) => Promise<{
135
+ did: string;
136
+ publicKey?: string | null;
137
+ privateKey?: string | null;
138
+ }>;
139
+ acts: {
140
+ list: (org_id: string, agent_did: string) => Promise<{
141
+ acts: {
142
+ [key: string]: unknown;
143
+ }[];
144
+ }>;
145
+ issue: (org_id: string, agent_did: string, body: Body<"iam_issueAgentAct">) => Promise<{
146
+ id: string;
147
+ act: string;
148
+ scopes: string[];
149
+ issuedAt: string;
150
+ expiresAt: string;
151
+ subjectDid: string;
152
+ }>;
153
+ };
154
+ publication: (org_id: string, agent_id: string) => Promise<{
155
+ agentId: string;
156
+ state: "private" | "published" | "withdrawn";
157
+ version: number;
158
+ }>;
159
+ orbitMsgsGrant: (org_id: string, agent_id: string) => Promise<{
160
+ schemaVersion?: number;
161
+ requestId?: string;
162
+ agentId: string;
163
+ organizationId: string;
164
+ profile?: string;
165
+ ownerGeneration?: number;
166
+ grant?: {
167
+ grantId?: string;
168
+ grantVersion?: number;
169
+ actions?: string[];
170
+ expiresAtMs?: number;
171
+ status?: "active" | "expired" | "revoked";
172
+ } | null;
173
+ }>;
174
+ /** A published agent's public card (anonymous). */
175
+ publicCard: (agent_id: string) => Promise<{
176
+ schemaVersion?: number;
177
+ principalId: string;
178
+ kind: string;
179
+ publicationVersion?: number;
180
+ canonicalAgentDid?: string;
181
+ handle?: string | null;
182
+ handleStatus?: string;
183
+ contact?: {
184
+ [key: string]: unknown;
185
+ };
186
+ operatingCompany?: Record<string, never> | null;
187
+ }>;
188
+ /** Agents enrolled for a Mind with a currently valid credential. */
189
+ forMind: (org_id: string, mind_id: string) => Promise<{
190
+ items: {
191
+ agent: import("./index.js").components["schemas"]["Iam.Agent"];
192
+ mindId: string;
193
+ scopes?: string[];
194
+ sharedNamespaces?: string[];
195
+ credentialExpiresAt?: number;
196
+ }[];
197
+ }>;
198
+ enrollmentGrants: (org_id: string) => Promise<{
199
+ items: import("./index.js").components["schemas"]["Iam.AgentEnrollmentGrant"][];
200
+ }>;
201
+ /**
202
+ * Enroll an agent under an agent enrollment grant. Only the grant's enrollment key (`mek_...`) is sent, as the bearer;
203
+ * this client's own Genesis credential is not. The credential secret in the answer is returned once.
204
+ */
205
+ enroll: (enrollmentKey: string, body: Body<"iam_enrollAgent">) => Promise<{
206
+ agent: {
207
+ id: string;
208
+ did: string;
209
+ displayName?: string;
210
+ status?: string;
211
+ organizationId: string;
212
+ projectId?: string;
213
+ };
214
+ created: boolean;
215
+ credential: {
216
+ id: string;
217
+ secret: string;
218
+ mindId?: string;
219
+ scopes?: string[];
220
+ sharedNamespaces?: string[];
221
+ expiresAt?: number;
222
+ };
223
+ }>;
224
+ };
225
+ roles: {
226
+ list: (org_id: string) => Promise<{
227
+ items: import("./index.js").components["schemas"]["Iam.Role"][];
228
+ next_cursor?: string | null;
229
+ }>;
230
+ get: (org_id: string, role_id: string) => Promise<{
231
+ id: string;
232
+ organization_id?: string;
233
+ name: string;
234
+ description?: string;
235
+ permissions: string[];
236
+ metadata?: {
237
+ [key: string]: unknown;
238
+ };
239
+ }>;
240
+ create: (org_id: string, body: Body<"iam_createRole">) => Promise<{
241
+ id: string;
242
+ organization_id?: string;
243
+ name: string;
244
+ description?: string;
245
+ permissions: string[];
246
+ metadata?: {
247
+ [key: string]: unknown;
248
+ };
249
+ }>;
250
+ update: (org_id: string, role_id: string, body: Body<"iam_updateRole">) => Promise<{
251
+ id: string;
252
+ organization_id?: string;
253
+ name: string;
254
+ description?: string;
255
+ permissions: string[];
256
+ metadata?: {
257
+ [key: string]: unknown;
258
+ };
259
+ }>;
260
+ delete: (org_id: string, role_id: string) => Promise<void>;
261
+ };
262
+ grants: {
263
+ list: (query?: Query<"iam_listGrants">) => Promise<{
264
+ items: import("./index.js").components["schemas"]["Iam.Grant"][];
265
+ next_cursor?: string | null;
266
+ }>;
267
+ get: (grant_id: string) => Promise<{
268
+ id: string;
269
+ principal_id: string;
270
+ organization_id: string;
271
+ project_id?: string;
272
+ platform_id?: string;
273
+ workspace_id?: string;
274
+ environmentId?: "live" | "sandbox";
275
+ role_ids: string[];
276
+ permissions?: string[];
277
+ expires_at?: number;
278
+ metadata?: {
279
+ [key: string]: unknown;
280
+ };
281
+ created_at: number;
282
+ }>;
283
+ /** `organization_id` must be your organization. With an idempotencyKey a retry returns the original grant. */
284
+ create: (body: Body<"iam_createGrant">, idempotencyKey?: string) => Promise<{
285
+ id: string;
286
+ principal_id: string;
287
+ organization_id: string;
288
+ project_id?: string;
289
+ platform_id?: string;
290
+ workspace_id?: string;
291
+ environmentId?: "live" | "sandbox";
292
+ role_ids: string[];
293
+ permissions?: string[];
294
+ expires_at?: number;
295
+ metadata?: {
296
+ [key: string]: unknown;
297
+ };
298
+ created_at: number;
299
+ }>;
300
+ update: (grant_id: string, body: Body<"iam_updateGrant">) => Promise<{
301
+ id: string;
302
+ principal_id: string;
303
+ organization_id: string;
304
+ project_id?: string;
305
+ platform_id?: string;
306
+ workspace_id?: string;
307
+ environmentId?: "live" | "sandbox";
308
+ role_ids: string[];
309
+ permissions?: string[];
310
+ expires_at?: number;
311
+ metadata?: {
312
+ [key: string]: unknown;
313
+ };
314
+ created_at: number;
315
+ }>;
316
+ delete: (grant_id: string) => Promise<void>;
317
+ };
318
+ capabilities: {
319
+ get: (capability_id: string) => Promise<{
320
+ id: string;
321
+ issuer_principal_id: string;
322
+ subject_principal_id: string;
323
+ organization_id: string;
324
+ permissions: string[];
325
+ constraints: import("./index.js").components["schemas"]["Iam.CapabilityConstraints"];
326
+ created_at: number;
327
+ revoked_at?: number;
328
+ revoke_reason?: string;
329
+ }>;
330
+ /** You are always the issuer; `organization_id` must be your organization. */
331
+ create: (body: Body<"iam_createCapability">, idempotencyKey?: string) => Promise<{
332
+ id: string;
333
+ issuer_principal_id: string;
334
+ subject_principal_id: string;
335
+ organization_id: string;
336
+ permissions: string[];
337
+ constraints: import("./index.js").components["schemas"]["Iam.CapabilityConstraints"];
338
+ created_at: number;
339
+ revoked_at?: number;
340
+ revoke_reason?: string;
341
+ }>;
342
+ update: (capability_id: string, body: Body<"iam_updateCapability">) => Promise<{
343
+ id: string;
344
+ issuer_principal_id: string;
345
+ subject_principal_id: string;
346
+ organization_id: string;
347
+ permissions: string[];
348
+ constraints: import("./index.js").components["schemas"]["Iam.CapabilityConstraints"];
349
+ created_at: number;
350
+ revoked_at?: number;
351
+ revoke_reason?: string;
352
+ }>;
353
+ /** Revoke (issuer only), with an optional recorded reason. */
354
+ delete: (capability_id: string, reason?: string) => Promise<void>;
355
+ verify: (body: Body<"iam_verifyCapability">) => Promise<{
356
+ valid: boolean;
357
+ grant?: import("./index.js").components["schemas"]["Iam.Capability"];
358
+ reason_invalid?: "expired" | "revoked" | "scope_mismatch" | "tenant_mismatch" | "not_found";
359
+ }>;
360
+ };
361
+ platforms: () => Promise<{
362
+ items: import("./index.js").components["schemas"]["Iam.Platform"][];
363
+ next_cursor?: string | null;
364
+ }>;
365
+ tenantContext: () => Promise<{
366
+ tenant: import("./index.js").components["schemas"]["Iam.TenantContext"];
367
+ }>;
368
+ checkPermission: (body: Body<"iam_checkPermission">) => Promise<{
369
+ allowed: boolean;
370
+ evaluated_at?: number;
371
+ via?: string;
372
+ environmentId?: string;
373
+ }>;
374
+ requirePermission: (body: Body<"iam_requirePermission">) => Promise<{
375
+ allowed: boolean;
376
+ evaluated_at?: number;
377
+ via?: string;
378
+ environmentId?: string;
379
+ }>;
380
+ checkEntitlement: (body: Body<"iam_checkEntitlement">) => Promise<{
381
+ key: string;
382
+ organization_id: string;
383
+ enabled: boolean;
384
+ quota?: number | null;
385
+ remaining?: number | null;
386
+ evaluated_at?: number;
387
+ source?: string;
388
+ environmentId?: string;
389
+ }>;
390
+ };
391
+ export {};
package/dist/iam.js ADDED
@@ -0,0 +1,92 @@
1
+ import { GenesisError } from './errors.js';
2
+ import { idempotencyHeaders } from './idempotency.js';
3
+ const key = (operationId, idempotencyKey) => ({ headers: idempotencyHeaders(operationId, idempotencyKey) });
4
+ const ENROLLMENT_KEY = /^mek_[A-Za-z0-9_-]{16,512}$/;
5
+ /**
6
+ * IAM v4 tenant operations at /v1/iam/... (iam.l1fe.ai). Use a One account login or an organization API key with iam:read
7
+ * (reads) or iam:write (changes). The gateway exchanges either at Auth for a short-lived IAM token and forwards only that;
8
+ * IAM decides authority (owner or manager for most changes). `org_id` must be your own organization.
9
+ *
10
+ * Inviting members, changing member roles, removing members, Mind API keys and enterprise settings are not here: they stay
11
+ * with a person in the Console. Projects and workspaces are `genesis.projects` and `genesis.workspaces`.
12
+ */
13
+ export function iamModule(client) {
14
+ return {
15
+ orgs: {
16
+ list: (query = {}) => client.request('iam_listOrgs', query),
17
+ get: (org_id) => client.request('iam_getOrg', { org_id }),
18
+ update: (org_id, body) => client.request('iam_updateOrg', { org_id, body }),
19
+ members: (org_id, query = {}) => client.request('iam_listMembers', { org_id, ...query }),
20
+ entitlements: (org_id, environment_id) => client.request('iam_listEntitlements', { org_id, ...(environment_id ? { environment_id } : {}) }),
21
+ },
22
+ fleets: {
23
+ list: (org_id) => client.request('iam_listFleets', { org_id }),
24
+ get: (org_id, fleet_id) => client.request('iam_getFleet', { org_id, fleet_id }),
25
+ /** Reuse the same idempotencyKey to replay an uncertain create instead of making a second fleet. */
26
+ create: (org_id, body, idempotencyKey) => client.request('iam_createFleet', { org_id, body }, key('iam_createFleet', idempotencyKey)),
27
+ update: (org_id, fleet_id, body) => client.request('iam_updateFleet', { org_id, fleet_id, body }),
28
+ /** Permanent; IAM refuses while grants reference the fleet. */
29
+ delete: (org_id, fleet_id) => client.request('iam_deleteFleet', { org_id, fleet_id }),
30
+ },
31
+ agents: {
32
+ list: (org_id) => client.request('iam_listAgents', { org_id }),
33
+ get: (org_id, agent_did) => client.request('iam_getAgent', { org_id, agent_did }),
34
+ /** Without `publicKey` IAM generates a key pair and returns `privateKey` once. */
35
+ create: (org_id, body) => client.request('iam_createAgent', { org_id, body }),
36
+ /** Revokes the agent (status `revoked`); the record stays. */
37
+ delete: (org_id, agent_did) => client.request('iam_deleteAgent', { org_id, agent_did }),
38
+ suspend: (org_id, agent_did) => client.request('iam_suspendAgent', { org_id, agent_did }),
39
+ resume: (org_id, agent_did) => client.request('iam_resumeAgent', { org_id, agent_did }),
40
+ rotate: (org_id, agent_did, body = {}) => client.request('iam_rotateAgentKey', { org_id, agent_did, body }),
41
+ acts: {
42
+ list: (org_id, agent_did) => client.request('iam_listAgentActs', { org_id, agent_did }),
43
+ issue: (org_id, agent_did, body) => client.request('iam_issueAgentAct', { org_id, agent_did, body }),
44
+ },
45
+ publication: (org_id, agent_id) => client.request('iam_getAgentPublication', { org_id, agent_id }),
46
+ orbitMsgsGrant: (org_id, agent_id) => client.request('iam_getOrbitMsgsProductGrant', { org_id, agent_id }),
47
+ /** A published agent's public card (anonymous). */
48
+ publicCard: (agent_id) => client.request('iam_getPublicAgent', { agent_id }),
49
+ /** Agents enrolled for a Mind with a currently valid credential. */
50
+ forMind: (org_id, mind_id) => client.request('iam_listMindAgents', { org_id, mind_id }),
51
+ enrollmentGrants: (org_id) => client.request('iam_listAgentEnrollmentGrants', { org_id }),
52
+ /**
53
+ * Enroll an agent under an agent enrollment grant. Only the grant's enrollment key (`mek_...`) is sent, as the bearer;
54
+ * this client's own Genesis credential is not. The credential secret in the answer is returned once.
55
+ */
56
+ enroll: (enrollmentKey, body) => {
57
+ if (typeof enrollmentKey !== 'string' || !ENROLLMENT_KEY.test(enrollmentKey))
58
+ throw new GenesisError({ status: 0, type: 'invalid_request', operationId: 'iam_enrollAgent', message: 'Agent enrollment needs the grant\'s enrollment key (mek_...).' });
59
+ return client.request('iam_enrollAgent', { body }, { headers: { authorization: `Bearer ${enrollmentKey}` } });
60
+ },
61
+ },
62
+ roles: {
63
+ list: (org_id) => client.request('iam_listRoles', { org_id }),
64
+ get: (org_id, role_id) => client.request('iam_getRole', { org_id, role_id }),
65
+ create: (org_id, body) => client.request('iam_createRole', { org_id, body }),
66
+ update: (org_id, role_id, body) => client.request('iam_updateRole', { org_id, role_id, body }),
67
+ delete: (org_id, role_id) => client.request('iam_deleteRole', { org_id, role_id }),
68
+ },
69
+ grants: {
70
+ list: (query = {}) => client.request('iam_listGrants', query),
71
+ get: (grant_id) => client.request('iam_getGrant', { grant_id }),
72
+ /** `organization_id` must be your organization. With an idempotencyKey a retry returns the original grant. */
73
+ create: (body, idempotencyKey) => client.request('iam_createGrant', { body }, key('iam_createGrant', idempotencyKey)),
74
+ update: (grant_id, body) => client.request('iam_updateGrant', { grant_id, body }),
75
+ delete: (grant_id) => client.request('iam_deleteGrant', { grant_id }),
76
+ },
77
+ capabilities: {
78
+ get: (capability_id) => client.request('iam_getCapability', { capability_id }),
79
+ /** You are always the issuer; `organization_id` must be your organization. */
80
+ create: (body, idempotencyKey) => client.request('iam_createCapability', { body }, key('iam_createCapability', idempotencyKey)),
81
+ update: (capability_id, body) => client.request('iam_updateCapability', { capability_id, body }),
82
+ /** Revoke (issuer only), with an optional recorded reason. */
83
+ delete: (capability_id, reason) => client.request('iam_deleteCapability', { capability_id, body: reason === undefined ? {} : { reason } }),
84
+ verify: (body) => client.request('iam_verifyCapability', { body }),
85
+ },
86
+ platforms: () => client.request('iam_listPlatforms'),
87
+ tenantContext: () => client.request('iam_getTenantContext'),
88
+ checkPermission: (body) => client.request('iam_checkPermission', { body }),
89
+ requirePermission: (body) => client.request('iam_requirePermission', { body }),
90
+ checkEntitlement: (body) => client.request('iam_checkEntitlement', { body }),
91
+ };
92
+ }
@@ -2,3 +2,6 @@ import { type OperationId } from './generated/operations.js';
2
2
  /** The Idempotency-Key header an operation's spec declares. A required key is refused locally when missing
3
3
  * or malformed, before any request is sent; reuse the same key to replay instead of acting twice. */
4
4
  export declare function idempotencyHeaders(operationId: OperationId, key: string | undefined): Record<string, string>;
5
+ /** The If-Match header an operation's spec requires (Auto's optimistic concurrency): the resource `version`
6
+ * you read, or its ETag. A missing or malformed version is refused locally, before anything is sent. */
7
+ export declare function ifMatchHeaders(operationId: OperationId, version: string | number | undefined): Record<string, string>;
@@ -2,6 +2,8 @@ import { GenesisError } from './errors.js';
2
2
  import { operationTable } from './generated/operations.js';
3
3
  const REQUIRED = /^[\x21-\x7e]{8,128}$/;
4
4
  const OPTIONAL = /^[\x21-\x7e]{1,256}$/;
5
+ /** Auto's Idempotency-Key grammar (l1felabs/auto src/operating.ts IDEMPOTENCY_KEY). */
6
+ const AUTO_KEY = /^[A-Za-z0-9_.:-]{8,128}$/;
5
7
  /** The Idempotency-Key header an operation's spec declares. A required key is refused locally when missing
6
8
  * or malformed, before any request is sent; reuse the same key to replay instead of acting twice. */
7
9
  export function idempotencyHeaders(operationId, key) {
@@ -13,5 +15,25 @@ export function idempotencyHeaders(operationId, key) {
13
15
  message: need === 'required' ? `${operationId} needs a stable idempotency key (8-128 printable ASCII characters)`
14
16
  : need ? `${operationId} idempotency key must be 1-256 printable ASCII characters` : `${operationId} does not take an idempotency key` });
15
17
  }
18
+ // Auto takes 8-128 characters of [A-Za-z0-9_.:-] (its authority check); refuse anything it would 422 before sending.
19
+ if (operationTable[operationId].service === 'auto' && !AUTO_KEY.test(key)) {
20
+ throw new GenesisError({ status: 0, type: 'invalid_request', operationId,
21
+ message: `${operationId} idempotency key must be 8-128 characters of A-Z a-z 0-9 _ . : -` });
22
+ }
16
23
  return { 'idempotency-key': key };
17
24
  }
25
+ /** The If-Match header an operation's spec requires (Auto's optimistic concurrency): the resource `version`
26
+ * you read, or its ETag. A missing or malformed version is refused locally, before anything is sent. */
27
+ export function ifMatchHeaders(operationId, version) {
28
+ const need = operationTable[operationId].ifMatch;
29
+ if (!need) {
30
+ if (version === undefined)
31
+ return {};
32
+ throw new GenesisError({ status: 0, type: 'invalid_request', operationId, message: `${operationId} does not take If-Match` });
33
+ }
34
+ const v = typeof version === 'number' ? String(version) : version;
35
+ if (typeof v !== 'string' || !/^(?:W\/)?"?[1-9][0-9]{0,8}"?$/.test(v)) {
36
+ throw new GenesisError({ status: 0, type: 'invalid_request', operationId, message: `${operationId} needs the version you read (If-Match, e.g. 3)` });
37
+ }
38
+ return { 'if-match': `"${v.replace(/^W\//, '').replace(/"/g, '')}"` };
39
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { Genesis, type ChatMessage } from './genesis.js';
2
2
  export { GenesisClient, DEFAULT_BASE_URL, type GenesisOptions, type CredentialProvider } from './client.js';
3
+ export { iamDirectoryOperations, isIamDirectoryOperation, iamDirectoryFailure } from './iam-directory.js';
4
+ export { iamModule } from './iam.js';
3
5
  export { GenesisError, errorCatalog, errorToken, errorOutcome } from './errors.js';
4
6
  export { requireSecureUrl } from './urls.js';
5
7
  export { operationTable, services, type OperationId } from './generated/operations.js';
@@ -10,14 +12,23 @@ export { validateHivesInvocation, hivesFunctionResponseHeaders, HivesOperationEr
10
12
  export { hivesResponseBytes } from './hives-response.js';
11
13
  export { runnerModule, type RunnerStartInput, type RunnerSnapshot, type RunnerCatalog, type RunnerEvent, type RunnerProviderResult, type RunnerRequestOptions } from './runner.js';
12
14
  export type { RunnerSelfExecutionGrantInput, RunnerSelfExecutionGrant } from './runner-grant.js';
13
- export { beaconsModule } from './beacons.js';
15
+ export { beaconsModule, BEACONS_RESOURCE_FAMILIES, BEACONS_CLIENT_PLATFORMS, type BeaconsResourceFamily } from './beacons.js';
16
+ export type { BeaconsClientPlatform } from './beacons.js';
14
17
  export { rigsModule, panesModule, shellsModule } from './instances.js';
15
18
  export { gearsModule } from './gears.js';
19
+ export { tapsModule } from './taps.js';
16
20
  export { lanesModule } from './lanes.js';
17
21
  export { flaresModule } from './flares.js';
18
- export { idempotencyHeaders } from './idempotency.js';
22
+ export { idempotencyHeaders, ifMatchHeaders } from './idempotency.js';
23
+ export type { FlocksWriteOptions, WaitForJobOptions, FlocksJob } from './flocks.js';
24
+ export { autoModule } from './auto.js';
25
+ export { gardenModule } from './garden.js';
26
+ export { orgsEntitiesModule, type OrgsDocumentContent } from './orgs.js';
27
+ export { scopesModule } from './scopes.js';
28
+ export { billingModule, gatewayModule, orgsModule } from './gateway.js';
19
29
  export { dialsModule, dialsEmergencyAddressFeedback, type DialsEmergencyAddressFeedback, type DialsScope, type DialsOutboundCall, type DialsCallControl, type DialsEmergencyAddress, type DialsCallListItem, type DialsCallDispatchState, type DialsMessage, type DialsMessageTemplate, type DialsMessagingBrand, type DialsMessagingCampaign, type DialsWorkflowDocument, type DialsRoutingAction, type DialsRoutingRule, type DialsRoutingRuleReceipt, type DialsOutboundCallReceipt, type DialsRecoveredOutboundCallReceipt } from './dials.js';
20
30
  export { hivesObjectKey, type HivesBucket, type HivesObject, type HivesObjectAcknowledgement, type HivesObjectList, type HivesCorsRule, type HivesCreateBucket, type HivesPresign, type HivesPresignedUrl } from './hives-cells.js';
31
+ export { hivesSseEvents, hivesSseReader, type HivesLogStreamEvent, type HivesLogStreamQuery, type HivesLogWindow, type HivesLogWindowOptions } from './hives-platform.js';
21
32
  export { hivesQueueBody, type HivesQueue, type HivesQueueConfig, type HivesQueueCreate, type HivesQueueSend, type HivesQueueDelivery, type HivesDeadLetter, type HivesDeadLetterStats } from './hives-queues.js';
22
33
  export type { HivesRuntime, HivesRuntimeSelection } from './hives-runtimes.js';
23
34
  export type { HivesVolume, HivesVolumeCreate, HivesVolumeMount, HivesVolumePage } from './hives-volumes.js';
@@ -26,8 +37,11 @@ export type { HivesMarketplacePackage, HivesMarketplaceVersion, HivesMarketplace
26
37
  export type { HivesQueueConsumerConfig, HivesQueueConsumerBinding, HivesQueueConsumerAttempt, HivesQueueConsumerStatus } from './hives-queue-consumer.js';
27
38
  export { foundryBillingOperations, isFoundryBillingOperation } from './foundry-billing.js';
28
39
  export type { HivesTopic, HivesTopicSubscription, HivesTopicPublish, HivesTopicPublication } from './hives-topics.js';
29
- export { mindsModule, mindsOperations, isMindsOperation, type MindsCreateOptions, type MindsResumeOptions, type MindsStopOptions, type MindsWakeReason, type MindsRequestOptions, type MindsUsage, type MindsEventInput } from './minds.js';
30
- export { MindsAgentError, mindsAgentOperations, isMindsAgentOperation, type MindsAgentOptions, type MindsAgentEventInput } from './minds-agent.js';
40
+ export { mindsModule, mindsOperations, isMindsOperation, mindsServices, type MindsService, type MindsDeleteOptions, type MindsResizeOptions, type MindsCreateOptions, type MindsResumeOptions, type MindsStopOptions, type MindsWakeReason, type MindsRequestOptions, type MindsUsage, type MindsEventInput, type MindsWebhookDelivery, type MindsWebhookDeliveryReceipt } from './minds.js';
41
+ export { MindsAgentError, mindsAgentOperations, isMindsAgentOperation, mindsAgentCreateOperations, isMindsAgentCreateOperation, type MindsAgentOptions, type MindsAgentEventInput, type MindsAgentCreateInput, type MindsAgentCreateOptions } from './minds-agent.js';
42
+ export { mindsEngineModule, mindsEngineOperations, isMindsEngineOperation, mindsEngineCommands, type MindsEngineOperation, type MindsEngineOptions } from './minds-engine.js';
31
43
  export { MindsOwnerError, mindsOwnerOperations, isMindsOwnerOperation, type MindsOwnerOptions, type MindsOwnerVersion, type MindsAttachmentSubject, type MindsAttachInput } from './minds-owner.js';
32
44
  export { selectGenesisContext, checkedGenesisContextSession, type GenesisContextSelection, type GenesisContextSession } from './context.js';
33
45
  export { HivesQueueOperationError, hivesQueueOperationId, type HivesQueueOperation, type HivesQueueSendOptions } from './hives-queue-funding.js';
46
+ export { foldHenryTurns, type HenryRun, type HenryRunEvent, type HenryRunEventMessage, type HenryRunStreamStatus, type HenryMessageDelivery, type HenryStreamEvent, type HenryStreamOptions, type HenryTurn, type HenryReplay } from './henry.js';
47
+ export { hivesSseWindow, type HivesSseEvent, type HivesSseWindow, type HivesSseWindowOptions } from './hives-sse.js';
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  export { Genesis } from './genesis.js';
2
2
  export { GenesisClient, DEFAULT_BASE_URL } from './client.js';
3
+ export { iamDirectoryOperations, isIamDirectoryOperation, iamDirectoryFailure } from './iam-directory.js';
4
+ export { iamModule } from './iam.js';
3
5
  export { GenesisError, errorCatalog, errorToken, errorOutcome } from './errors.js';
4
6
  export { requireSecureUrl } from './urls.js';
5
7
  export { operationTable, services } from './generated/operations.js';
@@ -7,19 +9,29 @@ export { hivesUploadBody, MAX_WASM_BYTES } from './hives-upload.js';
7
9
  export { validateHivesInvocation, hivesFunctionResponseHeaders, HivesOperationError, MAX_FUNCTION_BODY_BYTES, MAX_FUNCTION_JSON_BYTES } from './hives-functions.js';
8
10
  export { hivesResponseBytes } from './hives-response.js';
9
11
  export { runnerModule } from './runner.js';
10
- export { beaconsModule } from './beacons.js';
12
+ export { beaconsModule, BEACONS_RESOURCE_FAMILIES, BEACONS_CLIENT_PLATFORMS } from './beacons.js';
11
13
  export { rigsModule, panesModule, shellsModule } from './instances.js';
12
14
  export { gearsModule } from './gears.js';
15
+ export { tapsModule } from './taps.js';
13
16
  export { lanesModule } from './lanes.js';
14
17
  export { flaresModule } from './flares.js';
15
- export { idempotencyHeaders } from './idempotency.js';
18
+ export { idempotencyHeaders, ifMatchHeaders } from './idempotency.js';
19
+ export { autoModule } from './auto.js';
20
+ export { gardenModule } from './garden.js';
21
+ export { orgsEntitiesModule } from './orgs.js';
22
+ export { scopesModule } from './scopes.js';
23
+ export { billingModule, gatewayModule, orgsModule } from './gateway.js';
16
24
  export { dialsModule, dialsEmergencyAddressFeedback } from './dials.js';
17
25
  export { hivesObjectKey } from './hives-cells.js';
26
+ export { hivesSseEvents, hivesSseReader } from './hives-platform.js';
18
27
  export { hivesQueueBody } from './hives-queues.js';
19
28
  export { HIVES_OBJECT_BYTES, HIVES_QUEUE_BYTES } from './hives-resources-transport.js';
20
29
  export { foundryBillingOperations, isFoundryBillingOperation } from './foundry-billing.js';
21
- export { mindsModule, mindsOperations, isMindsOperation } from './minds.js';
22
- export { MindsAgentError, mindsAgentOperations, isMindsAgentOperation } from './minds-agent.js';
30
+ export { mindsModule, mindsOperations, isMindsOperation, mindsServices } from './minds.js';
31
+ export { MindsAgentError, mindsAgentOperations, isMindsAgentOperation, mindsAgentCreateOperations, isMindsAgentCreateOperation } from './minds-agent.js';
32
+ export { mindsEngineModule, mindsEngineOperations, isMindsEngineOperation, mindsEngineCommands } from './minds-engine.js';
23
33
  export { MindsOwnerError, mindsOwnerOperations, isMindsOwnerOperation } from './minds-owner.js';
24
34
  export { selectGenesisContext, checkedGenesisContextSession } from './context.js';
25
35
  export { HivesQueueOperationError, hivesQueueOperationId } from './hives-queue-funding.js';
36
+ export { foldHenryTurns } from './henry.js';
37
+ export { hivesSseWindow } from './hives-sse.js';