@onesi/genesis 0.1.13 → 0.2.1

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 (80) 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 +121 -0
  7. package/dist/blinds-owner-enrollment.js +23 -2
  8. package/dist/boxes.d.ts +1074 -0
  9. package/dist/boxes.js +338 -0
  10. package/dist/client.d.ts +3 -19947
  11. package/dist/client.js +127 -18
  12. package/dist/errors.d.ts +6 -0
  13. package/dist/errors.js +38 -3
  14. package/dist/flares.d.ts +32 -0
  15. package/dist/flares.js +5 -0
  16. package/dist/fleets.d.ts +32 -0
  17. package/dist/fleets.js +59 -6
  18. package/dist/flocks.d.ts +334 -1
  19. package/dist/flocks.js +85 -0
  20. package/dist/foundry.d.ts +429 -0
  21. package/dist/foundry.js +135 -0
  22. package/dist/garden.d.ts +754 -0
  23. package/dist/garden.js +76 -0
  24. package/dist/gateway.d.ts +365 -0
  25. package/dist/gateway.js +82 -0
  26. package/dist/gears.d.ts +121 -2
  27. package/dist/gears.js +24 -2
  28. package/dist/generated/operations.d.ts +3 -19948
  29. package/dist/generated/operations.js +64214 -13423
  30. package/dist/generated/schema.d.ts +85708 -17364
  31. package/dist/genesis.d.ts +9041 -1250
  32. package/dist/genesis.js +92 -25
  33. package/dist/genesis.openapi.json +133172 -31267
  34. package/dist/henry.d.ts +202 -1
  35. package/dist/henry.js +223 -0
  36. package/dist/hives-cells.d.ts +8 -3
  37. package/dist/hives-cells.js +17 -4
  38. package/dist/hives-environment.d.ts +9 -0
  39. package/dist/hives-environment.js +22 -0
  40. package/dist/hives-node.js +4 -1
  41. package/dist/hives-operations.d.ts +121 -3
  42. package/dist/hives-operations.js +2 -0
  43. package/dist/hives-platform.d.ts +149 -0
  44. package/dist/hives-platform.js +183 -0
  45. package/dist/hives-resources-transport.d.ts +7 -1
  46. package/dist/hives-resources-transport.js +10 -2
  47. package/dist/hives-sse.d.ts +24 -0
  48. package/dist/hives-sse.js +111 -0
  49. package/dist/hives-topics.d.ts +4 -3
  50. package/dist/hives-topics.js +9 -4
  51. package/dist/iam-directory.d.ts +8 -0
  52. package/dist/iam-directory.js +23 -0
  53. package/dist/iam.d.ts +397 -0
  54. package/dist/iam.js +92 -0
  55. package/dist/idempotency.d.ts +3 -0
  56. package/dist/idempotency.js +27 -0
  57. package/dist/index.d.ts +22 -6
  58. package/dist/index.js +19 -5
  59. package/dist/instances.d.ts +177 -2
  60. package/dist/instances.js +37 -5
  61. package/dist/minds-agent.d.ts +28 -0
  62. package/dist/minds-agent.js +53 -10
  63. package/dist/minds-engine.d.ts +394 -0
  64. package/dist/minds-engine.js +555 -0
  65. package/dist/minds.d.ts +109 -1
  66. package/dist/minds.js +49 -14
  67. package/dist/orgs.d.ts +405 -0
  68. package/dist/orgs.js +63 -0
  69. package/dist/redact.d.ts +37 -0
  70. package/dist/redact.js +330 -0
  71. package/dist/runner.d.ts +4 -0
  72. package/dist/runner.js +1 -0
  73. package/dist/scopes.d.ts +316 -0
  74. package/dist/scopes.js +40 -0
  75. package/dist/taps.d.ts +118 -0
  76. package/dist/taps.js +45 -0
  77. package/dist/traces.d.ts +574 -0
  78. package/dist/traces.js +97 -0
  79. package/dist/types.d.ts +12 -1
  80. package/package.json +1 -1
package/dist/minds.d.ts CHANGED
@@ -1,9 +1,14 @@
1
1
  import type { GenesisClient } from './client.js';
2
2
  import type { OperationInput, OperationOutput } from './types.js';
3
- export declare const mindsOperations: readonly ["minds_listMinds", "minds_getMind", "minds_getUsage", "minds_createMind", "minds_resumeMind", "minds_stopMind", "minds_insertEpisodicMemory", "minds_getEpisodicMemory", "minds_updateEpisodicMemory", "minds_searchMemory"];
3
+ export declare const mindsOperations: readonly ["minds_listMinds", "minds_getMind", "minds_getUsage", "minds_createMind", "minds_resumeMind", "minds_stopMind", "minds_deleteMind", "minds_resizeMind", "minds_insertEpisodicMemory", "minds_getEpisodicMemory", "minds_updateEpisodicMemory", "minds_searchMemory", "minds_createWebhookDelivery", "minds_getWebhookDelivery"];
4
+ /** Engine service groups a create may choose (the controller's CREATE_SERVICES); kv and memory always run. */
5
+ export declare const mindsServices: readonly ["kv", "memory", "graph", "analytics", "ml", "inference", "vector", "snn", "continual", "associative-memory", "cognitive", "cognitive-cycle", "mcp"];
6
+ export type MindsService = typeof mindsServices[number];
4
7
  export declare const isMindsOperation: (id: string) => boolean;
5
8
  export type MindsEventInput = OperationInput<'minds_insertEpisodicMemory'>['body']['event'];
6
9
  export type MindsUsage = OperationOutput<'minds_getUsage'>;
10
+ export type MindsWebhookDelivery = OperationInput<'minds_createWebhookDelivery'>['body'];
11
+ export type MindsWebhookDeliveryReceipt = OperationOutput<'minds_getWebhookDelivery'>;
7
12
  export interface MindsRequestOptions {
8
13
  signal?: AbortSignal;
9
14
  }
@@ -15,11 +20,14 @@ export interface MindsResumeOptions extends MindsRequestOptions {
15
20
  export interface MindsStopOptions extends MindsRequestOptions {
16
21
  idempotencyKey: string;
17
22
  }
23
+ export type MindsDeleteOptions = MindsStopOptions;
24
+ export type MindsResizeOptions = MindsStopOptions;
18
25
  export interface MindsCreateOptions extends MindsRequestOptions {
19
26
  idempotencyKey: string;
20
27
  contextSha256: string;
21
28
  plan?: 'free' | 'pro';
22
29
  profileId?: 'F1' | 'D1' | 'D2';
30
+ services?: MindsService[];
23
31
  }
24
32
  /** One dispatch only. Creation retains its operation key; episodic insertion returns a storage UUID distinct from event.id. */
25
33
  export declare function mindsTransport(options: {
@@ -34,6 +42,18 @@ export declare function mindsTransport(options: {
34
42
  }): Promise<Response>;
35
43
  export declare function mindsModule(client: GenesisClient): {
36
44
  agent: {
45
+ create: (input: import("./minds-agent.js").MindsAgentCreateInput, options: import("./minds-agent.js").MindsAgentCreateOptions) => Promise<{
46
+ mind_id: string;
47
+ status: string;
48
+ } & {
49
+ [key: string]: unknown;
50
+ }>;
51
+ createStatus: (operation_id: string, options: import("./minds-agent.js").MindsAgentCreateOptions) => Promise<{
52
+ mind_id: string;
53
+ status: string;
54
+ } & {
55
+ [key: string]: unknown;
56
+ }>;
37
57
  memory: {
38
58
  insert: (mind: string, event: import("./minds-agent.js").MindsAgentEventInput, options?: import("./minds-agent.js").MindsAgentOptions) => Promise<{
39
59
  id: string;
@@ -173,6 +193,94 @@ export declare function mindsModule(client: GenesisClient): {
173
193
  } & {
174
194
  [key: string]: unknown;
175
195
  }>;
196
+ /** Deletes the Mind (controller lifecycle delete): human delete permission, or an org API key with minds:write. */
197
+ delete: (mind_id: string, expected_generation: number, options: MindsDeleteOptions) => Promise<{
198
+ schema_version: "minds.controller.v1";
199
+ mind_id: string;
200
+ organization_id: string;
201
+ project_id: string;
202
+ name: string;
203
+ region: string;
204
+ plan: "free" | "pro";
205
+ capacity: import("./index.js").components["schemas"]["Minds.Capacity"];
206
+ observed_capacity: import("./index.js").components["schemas"]["Minds.Capacity"] | null;
207
+ services: string[];
208
+ volume_id: string;
209
+ base_url: string;
210
+ desired_state: "running" | "stopped" | "deleted";
211
+ observed_state: "pending" | "running" | "stopped" | "deleted" | "failed" | "uncertain";
212
+ desired_generation: number;
213
+ observed_generation: number;
214
+ status: "ready" | "provisioning" | "stopped" | "deleted" | "failed" | "uncertain";
215
+ capacity_applied: boolean;
216
+ operation_id: string | null;
217
+ error_code: string | null;
218
+ created_at: string;
219
+ updated_at: string;
220
+ } & {
221
+ [key: string]: unknown;
222
+ }>;
223
+ /** Resizes to an existing Pro profile (F1/D1/D2): human manage permission, or an org API key with minds:manage. */
224
+ resize: (mind_id: string, expected_generation: number, profile_id: "F1" | "D1" | "D2", options: MindsResizeOptions) => Promise<{
225
+ schema_version: "minds.controller.v1";
226
+ mind_id: string;
227
+ organization_id: string;
228
+ project_id: string;
229
+ name: string;
230
+ region: string;
231
+ plan: "free" | "pro";
232
+ capacity: import("./index.js").components["schemas"]["Minds.Capacity"];
233
+ observed_capacity: import("./index.js").components["schemas"]["Minds.Capacity"] | null;
234
+ services: string[];
235
+ volume_id: string;
236
+ base_url: string;
237
+ desired_state: "running" | "stopped" | "deleted";
238
+ observed_state: "pending" | "running" | "stopped" | "deleted" | "failed" | "uncertain";
239
+ desired_generation: number;
240
+ observed_generation: number;
241
+ status: "ready" | "provisioning" | "stopped" | "deleted" | "failed" | "uncertain";
242
+ capacity_applied: boolean;
243
+ operation_id: string | null;
244
+ error_code: string | null;
245
+ created_at: string;
246
+ updated_at: string;
247
+ } & {
248
+ [key: string]: unknown;
249
+ }>;
250
+ webhookDeliveries: {
251
+ create: (mind_id: string, delivery: MindsWebhookDelivery, options?: MindsRequestOptions) => Promise<{
252
+ schema_version: "minds.webhook-delivery.v1";
253
+ delivery_id: string;
254
+ mind_id: string;
255
+ organization_id: string;
256
+ project_id: string;
257
+ issuer_principal_id: string;
258
+ event_reference: string;
259
+ event_sha256: string;
260
+ received_at: string;
261
+ outcome: "wake_queued" | "activity_recorded" | "ignored";
262
+ reason: "deleted" | "user_stopped" | "operation_in_flight" | "not_ready" | null;
263
+ operation_id: string | null;
264
+ generation: number;
265
+ wake_reason: "webhook";
266
+ }>;
267
+ get: (mind_id: string, delivery_id: string, options?: MindsRequestOptions) => Promise<{
268
+ schema_version: "minds.webhook-delivery.v1";
269
+ delivery_id: string;
270
+ mind_id: string;
271
+ organization_id: string;
272
+ project_id: string;
273
+ issuer_principal_id: string;
274
+ event_reference: string;
275
+ event_sha256: string;
276
+ received_at: string;
277
+ outcome: "wake_queued" | "activity_recorded" | "ignored";
278
+ reason: "deleted" | "user_stopped" | "operation_in_flight" | "not_ready" | null;
279
+ operation_id: string | null;
280
+ generation: number;
281
+ wake_reason: "webhook";
282
+ }>;
283
+ };
176
284
  memory: {
177
285
  insert: (mind: string, event: MindsEventInput, options?: MindsRequestOptions) => Promise<{
178
286
  id: string;
package/dist/minds.js CHANGED
@@ -1,11 +1,15 @@
1
1
  import { GenesisError } from './errors.js';
2
2
  import { mindsAgentModule } from './minds-agent.js';
3
3
  import { mindsOwnerModule } from './minds-owner.js';
4
- export const mindsOperations = ['minds_listMinds', 'minds_getMind', 'minds_getUsage', 'minds_createMind', 'minds_resumeMind', 'minds_stopMind', 'minds_insertEpisodicMemory', 'minds_getEpisodicMemory', 'minds_updateEpisodicMemory', 'minds_searchMemory'];
4
+ export const mindsOperations = ['minds_listMinds', 'minds_getMind', 'minds_getUsage', 'minds_createMind', 'minds_resumeMind', 'minds_stopMind', 'minds_deleteMind', 'minds_resizeMind', 'minds_insertEpisodicMemory', 'minds_getEpisodicMemory', 'minds_updateEpisodicMemory', 'minds_searchMemory', 'minds_createWebhookDelivery', 'minds_getWebhookDelivery'];
5
+ /** Engine service groups a create may choose (the controller's CREATE_SERVICES); kv and memory always run. */
6
+ export const mindsServices = ['kv', 'memory', 'graph', 'analytics', 'ml', 'inference', 'vector', 'snn', 'continual', 'associative-memory', 'cognitive', 'cognitive-cycle', 'mcp'];
5
7
  export const isMindsOperation = (id) => mindsOperations.includes(id);
6
8
  const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
7
9
  const uuid4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
8
- const writes = new Set(['minds_createMind', 'minds_resumeMind', 'minds_stopMind', 'minds_insertEpisodicMemory', 'minds_updateEpisodicMemory']);
10
+ const lifecycle = ['minds_resumeMind', 'minds_stopMind', 'minds_deleteMind', 'minds_resizeMind'];
11
+ const writes = new Set(['minds_createMind', 'minds_resumeMind', 'minds_stopMind', 'minds_deleteMind', 'minds_resizeMind', 'minds_insertEpisodicMemory', 'minds_updateEpisodicMemory', 'minds_createWebhookDelivery']);
12
+ const nilUuid = '00000000-0000-0000-0000-000000000000';
9
13
  // Match the native gateway's RFC3339/calendar and nanosecond window bounds.
10
14
  function usageInstant(value) {
11
15
  if (typeof value !== 'string' || value.length > 40)
@@ -31,11 +35,16 @@ export async function mindsTransport(options) {
31
35
  const id = options.operationId, input = options.input, write = writes.has(id);
32
36
  let dispatchAttempted = false;
33
37
  const error = (status, type, code, unknownOutcome = false) => new GenesisError({ status, type, code, operationId: id,
34
- message: status === 403 ? 'Minds requires an admitted original human One account session with a Console Sandbox selection.'
35
- : write ? 'Minds write was not confirmed. Preserve the lifecycle/create key or reconcile memory before an explicit retry.' : 'Minds request was not confirmed.',
38
+ message: status === 403 ? code === 'HUMAN_SANDBOX_SELECTION_REQUIRED'
39
+ ? 'HUMAN_SANDBOX_SELECTION_REQUIRED: Minds accepts an original human One account session with a Console Sandbox selection, or organization API keys with a selected (bound) context; M2M tokens are refused.'
40
+ : code === 'SCOPE_MISSING' ? 'SCOPE_MISSING: this organization API key lacks the Minds scope the operation needs (minds:read, minds:write or minds:manage; minds:manage does not imply read).'
41
+ : 'Minds requires an admitted original human One account session with a Console Sandbox selection, or an organization API key with the operation\'s Minds scope.'
42
+ : write ? 'Minds write was not confirmed. Preserve the lifecycle/create key or delivery_id, or reconcile memory, before an explicit retry.' : 'Minds request was not confirmed.',
36
43
  ...(write && (unknownOutcome || dispatchAttempted && (status === 0 || status >= 500 || type === 'invalid_response')) ? { body: { outcome: 'unknown' } } : {}) });
37
- const fields = id === 'minds_getUsage' ? ['from', 'to'] : id === 'minds_listMinds' ? ['after', 'limit'] : id === 'minds_getMind' ? ['mind_id'] : id === 'minds_updateEpisodicMemory' ? ['mind', 'storage_id', 'body'] : ['minds_resumeMind', 'minds_stopMind'].includes(id) ? ['mind_id', 'body']
38
- : id === 'minds_createMind' ? ['body'] : id === 'minds_getEpisodicMemory' ? ['mind', 'storage_id'] : ['mind', 'body'];
44
+ const fields = id === 'minds_getUsage' ? ['from', 'to'] : id === 'minds_listMinds' ? ['after', 'limit'] : id === 'minds_getMind' ? ['mind_id'] : id === 'minds_updateEpisodicMemory' ? ['mind', 'storage_id', 'body'] : ['minds_resumeMind', 'minds_stopMind', 'minds_resizeMind'].includes(id) ? ['mind_id', 'body']
45
+ : id === 'minds_deleteMind' ? ['mind_id', 'expected_generation']
46
+ : id === 'minds_createMind' ? ['body'] : id === 'minds_getEpisodicMemory' ? ['mind', 'storage_id'] : id === 'minds_createWebhookDelivery' ? ['mind_id', 'body']
47
+ : id === 'minds_getWebhookDelivery' ? ['mind_id', 'delivery_id'] : ['mind', 'body'];
39
48
  if (options.routing !== 'gateway' || !isMindsOperation(id) || Object.keys(input).some(key => !fields.includes(key)))
40
49
  throw error(0, 'invalid_request');
41
50
  if (id === 'minds_getUsage') {
@@ -43,7 +52,7 @@ export async function mindsTransport(options) {
43
52
  if (from === undefined || to === undefined || to <= from || to - from > 93n * 86400n * 1000000000n)
44
53
  throw error(0, 'invalid_request');
45
54
  }
46
- for (const key of ['mind', 'mind_id', 'storage_id', 'after'])
55
+ for (const key of ['mind', 'mind_id', 'storage_id', 'after', 'delivery_id'])
47
56
  if (input[key] !== undefined && (typeof input[key] !== 'string' || !uuid.test(input[key])))
48
57
  throw error(0, 'invalid_request');
49
58
  if (id === 'minds_updateEpisodicMemory') {
@@ -54,11 +63,22 @@ export async function mindsTransport(options) {
54
63
  || typeof body.content !== 'string' || !body.content.trim() || body.content.length > 16_000)
55
64
  throw error(0, 'invalid_request');
56
65
  }
66
+ if (id === 'minds_createWebhookDelivery' || id === 'minds_getWebhookDelivery') {
67
+ const body = input.body;
68
+ if (input.mind_id === nilUuid || input.delivery_id === nilUuid || (id === 'minds_getWebhookDelivery' ? typeof input.delivery_id !== 'string'
69
+ : !body || typeof body !== 'object' || Array.isArray(body) || Object.keys(body).sort().join() !== 'delivery_id,event_reference,event_sha256'
70
+ || typeof body.delivery_id !== 'string' || !uuid.test(body.delivery_id) || body.delivery_id === nilUuid
71
+ || typeof body.event_reference !== 'string' || body.event_reference.length > 200 || !/^[A-Za-z0-9_.:/-]+$/.test(body.event_reference)
72
+ || typeof body.event_sha256 !== 'string' || !/^[0-9a-f]{64}$/.test(body.event_sha256)))
73
+ throw error(0, 'invalid_request');
74
+ }
57
75
  if (id === 'minds_createMind') {
58
76
  const body = input.body;
59
77
  if (!uuid4.test(options.headers?.['idempotency-key'] ?? '') || !/^[a-f0-9]{64}$/.test(options.headers?.['x-genesis-minds-creation-context'] ?? '')
60
78
  || !body || typeof body !== 'object' || Array.isArray(body) || typeof body.name !== 'string'
61
- || Object.keys(body).some(key => !['name', 'plan', 'profile_id'].includes(key))
79
+ || Object.keys(body).some(key => !['name', 'plan', 'profile_id', 'services'].includes(key))
80
+ || (body.services !== undefined && (!Array.isArray(body.services) || new Set(body.services).size !== body.services.length
81
+ || body.services.some(service => !mindsServices.includes(service))))
62
82
  || (body.plan !== undefined && body.plan !== 'free' && body.plan !== 'pro')
63
83
  || (body.profile_id !== undefined && (typeof body.profile_id !== 'string' || !['F1', 'D1', 'D2'].includes(body.profile_id) || (body.plan !== 'pro' && body.profile_id !== 'F1'))))
64
84
  throw error(0, 'invalid_request');
@@ -72,6 +92,13 @@ export async function mindsTransport(options) {
72
92
  || body.expected_generation >= Number.MAX_SAFE_INTEGER)
73
93
  throw error(0, 'invalid_request');
74
94
  }
95
+ if (id === 'minds_deleteMind' || id === 'minds_resizeMind') {
96
+ const body = input.body, generation = id === 'minds_deleteMind' ? input.expected_generation : body?.expected_generation;
97
+ if (!uuid4.test(options.headers?.['idempotency-key'] ?? '') || !Number.isSafeInteger(generation) || generation < 1 || generation >= Number.MAX_SAFE_INTEGER
98
+ || (id === 'minds_resizeMind' && (!body || typeof body !== 'object' || Array.isArray(body) || Object.keys(body).sort().join() !== 'expected_generation,profile_id'
99
+ || !['F1', 'D1', 'D2'].includes(body.profile_id))))
100
+ throw error(0, 'invalid_request');
101
+ }
75
102
  const controller = new AbortController(), cancel = () => controller.abort(options.signal?.reason);
76
103
  options.signal?.addEventListener('abort', cancel, { once: true });
77
104
  if (options.signal?.aborted)
@@ -97,9 +124,9 @@ export async function mindsTransport(options) {
97
124
  throw error(0, 'invalid_request');
98
125
  const response = await bounded(() => {
99
126
  dispatchAttempted = true;
100
- return options.fetch(options.url, { method: id === 'minds_updateEpisodicMemory' ? 'PUT' : ['minds_listMinds', 'minds_getMind', 'minds_getUsage', 'minds_getEpisodicMemory'].includes(id) ? 'GET' : 'POST',
127
+ return options.fetch(options.url, { method: id === 'minds_updateEpisodicMemory' ? 'PUT' : id === 'minds_deleteMind' ? 'DELETE' : ['minds_listMinds', 'minds_getMind', 'minds_getUsage', 'minds_getEpisodicMemory', 'minds_getWebhookDelivery'].includes(id) ? 'GET' : 'POST',
101
128
  headers: { authorization: `Bearer ${credential}`, accept: 'application/json', ...(body === undefined ? {} : { 'content-type': 'application/json' }),
102
- ...(['minds_resumeMind', 'minds_stopMind'].includes(id) ? { 'idempotency-key': options.headers['idempotency-key'] } : {}),
129
+ ...(lifecycle.includes(id) ? { 'idempotency-key': options.headers['idempotency-key'] } : {}),
103
130
  ...(id === 'minds_createMind' ? { 'idempotency-key': options.headers['idempotency-key'], 'x-genesis-minds-creation-context': options.headers['x-genesis-minds-creation-context'] } : {}) },
104
131
  ...(body === undefined ? {} : { body }), signal: controller.signal, redirect: 'error', cache: 'no-store' }).then(result => {
105
132
  if (controller.signal.aborted) {
@@ -153,11 +180,11 @@ export async function mindsTransport(options) {
153
180
  const detail = row && Object.hasOwn(row, 'error') && row.error && typeof row.error === 'object' && !Array.isArray(row.error)
154
181
  ? row.error : undefined;
155
182
  const code = detail && Object.hasOwn(detail, 'code') && typeof detail.code === 'string' ? detail.code : undefined;
156
- const unknownOutcome = ['minds_resumeMind', 'minds_stopMind'].includes(id) && response.status === 401 && code === 'SELECTION_EXPIRED'
183
+ const unknownOutcome = lifecycle.includes(id) && response.status === 401 && code === 'SELECTION_EXPIRED'
157
184
  && detail !== undefined && Object.hasOwn(detail, 'outcome') && detail.outcome === 'unknown';
158
- throw error(response.status, 'minds_error', code, unknownOutcome);
185
+ throw error(response.status, 'minds_error', code, unknownOutcome || id === 'minds_createWebhookDelivery' && detail?.outcome === 'unknown');
159
186
  }
160
- if (['minds_createMind', 'minds_resumeMind', 'minds_stopMind'].includes(id) && response.status !== 202)
187
+ if (['minds_createMind', ...lifecycle, 'minds_createWebhookDelivery'].includes(id) && response.status !== 202)
161
188
  throw error(response.status, 'invalid_response');
162
189
  return Response.json(value, { status: response.status, headers: { 'cache-control': 'no-store' } });
163
190
  }
@@ -179,10 +206,18 @@ export function mindsModule(client) {
179
206
  list: (query = {}, options = {}) => client.request('minds_listMinds', query, options),
180
207
  get: (mind_id, options = {}) => client.request('minds_getMind', { mind_id }, options),
181
208
  usage: (window, options = {}) => client.request('minds_getUsage', window, options),
182
- create: (name, options) => client.request('minds_createMind', { body: { name, ...(options.plan === undefined ? {} : { plan: options.plan }), ...(options.profileId === undefined ? {} : { profile_id: options.profileId }) } }, { signal: options.signal,
209
+ create: (name, options) => client.request('minds_createMind', { body: { name, ...(options.plan === undefined ? {} : { plan: options.plan }), ...(options.profileId === undefined ? {} : { profile_id: options.profileId }), ...(options.services === undefined ? {} : { services: options.services }) } }, { signal: options.signal,
183
210
  headers: { 'idempotency-key': options.idempotencyKey, 'x-genesis-minds-creation-context': options.contextSha256 } }),
184
211
  resume: (mind_id, expected_generation, options) => client.request('minds_resumeMind', { mind_id, body: { expected_generation, ...(options.wakeReason === undefined ? {} : { wake_reason: options.wakeReason }) } }, { signal: options.signal, headers: { 'idempotency-key': options.idempotencyKey } }),
185
212
  stop: (mind_id, expected_generation, options) => client.request('minds_stopMind', { mind_id, body: { expected_generation } }, { signal: options.signal, headers: { 'idempotency-key': options.idempotencyKey } }),
213
+ /** Deletes the Mind (controller lifecycle delete): human delete permission, or an org API key with minds:write. */
214
+ delete: (mind_id, expected_generation, options) => client.request('minds_deleteMind', { mind_id, expected_generation }, { signal: options.signal, headers: { 'idempotency-key': options.idempotencyKey } }),
215
+ /** Resizes to an existing Pro profile (F1/D1/D2): human manage permission, or an org API key with minds:manage. */
216
+ resize: (mind_id, expected_generation, profile_id, options) => client.request('minds_resizeMind', { mind_id, body: { expected_generation, profile_id } }, { signal: options.signal, headers: { 'idempotency-key': options.idempotencyKey } }),
217
+ webhookDeliveries: {
218
+ create: (mind_id, delivery, options = {}) => client.request('minds_createWebhookDelivery', { mind_id, body: delivery }, options),
219
+ get: (mind_id, delivery_id, options = {}) => client.request('minds_getWebhookDelivery', { mind_id, delivery_id }, options),
220
+ },
186
221
  memory: {
187
222
  insert: (mind, event, options = {}) => client.request('minds_insertEpisodicMemory', { mind, body: { event } }, options),
188
223
  get: (mind, storage_id, options = {}) => client.request('minds_getEpisodicMemory', { mind, storage_id }, options),