@onesi/genesis 0.0.0-stage → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +28 -2
  2. package/dist/beacons.d.ts +103 -0
  3. package/dist/beacons.js +77 -0
  4. package/dist/blinds-owner-enrollment.d.ts +171 -0
  5. package/dist/blinds-owner-enrollment.js +150 -0
  6. package/dist/client.d.ts +19996 -0
  7. package/dist/client.js +277 -0
  8. package/dist/context.d.ts +50 -0
  9. package/dist/context.js +153 -0
  10. package/dist/dials.d.ts +299 -0
  11. package/dist/dials.js +100 -0
  12. package/dist/errors.d.ts +35 -0
  13. package/dist/errors.js +66 -0
  14. package/dist/flares.d.ts +170 -0
  15. package/dist/flares.js +56 -0
  16. package/dist/fleets.d.ts +186 -0
  17. package/dist/fleets.js +136 -0
  18. package/dist/flocks.d.ts +155 -0
  19. package/dist/flocks.js +39 -0
  20. package/dist/foundry-billing.d.ts +97 -0
  21. package/dist/foundry-billing.js +107 -0
  22. package/dist/gears.d.ts +107 -0
  23. package/dist/gears.js +20 -0
  24. package/dist/generated/operations.d.ts +19949 -0
  25. package/dist/generated/operations.js +23846 -0
  26. package/dist/generated/schema.d.ts +35413 -0
  27. package/dist/generated/schema.js +1 -0
  28. package/dist/genesis.d.ts +2926 -0
  29. package/dist/genesis.js +206 -0
  30. package/dist/genesis.openapi.json +49321 -0
  31. package/dist/henry.d.ts +168 -0
  32. package/dist/henry.js +45 -0
  33. package/dist/hives-cells.d.ts +127 -0
  34. package/dist/hives-cells.js +151 -0
  35. package/dist/hives-environment.d.ts +28 -0
  36. package/dist/hives-environment.js +58 -0
  37. package/dist/hives-functions.d.ts +36 -0
  38. package/dist/hives-functions.js +185 -0
  39. package/dist/hives-marketplace.d.ts +128 -0
  40. package/dist/hives-marketplace.js +187 -0
  41. package/dist/hives-node.d.ts +9 -0
  42. package/dist/hives-node.js +152 -0
  43. package/dist/hives-operations.d.ts +337 -0
  44. package/dist/hives-operations.js +41 -0
  45. package/dist/hives-queue-consumer.d.ts +56 -0
  46. package/dist/hives-queue-consumer.js +95 -0
  47. package/dist/hives-queue-funding.d.ts +28 -0
  48. package/dist/hives-queue-funding.js +81 -0
  49. package/dist/hives-queues.d.ts +137 -0
  50. package/dist/hives-queues.js +143 -0
  51. package/dist/hives-resources-transport.d.ts +23 -0
  52. package/dist/hives-resources-transport.js +204 -0
  53. package/dist/hives-response.d.ts +2 -0
  54. package/dist/hives-response.js +32 -0
  55. package/dist/hives-runtimes.d.ts +34 -0
  56. package/dist/hives-runtimes.js +32 -0
  57. package/dist/hives-topics.d.ts +51 -0
  58. package/dist/hives-topics.js +79 -0
  59. package/dist/hives-upload.d.ts +9 -0
  60. package/dist/hives-upload.js +23 -0
  61. package/dist/hives-volumes.d.ts +64 -0
  62. package/dist/hives-volumes.js +117 -0
  63. package/dist/idempotency.d.ts +4 -0
  64. package/dist/idempotency.js +17 -0
  65. package/dist/index.d.ts +33 -0
  66. package/dist/index.js +25 -0
  67. package/dist/instances.d.ts +25 -0
  68. package/dist/instances.js +11 -0
  69. package/dist/lanes.d.ts +267 -0
  70. package/dist/lanes.js +41 -0
  71. package/dist/minds-agent.d.ts +60 -0
  72. package/dist/minds-agent.js +190 -0
  73. package/dist/minds-owner.d.ts +110 -0
  74. package/dist/minds-owner.js +226 -0
  75. package/dist/minds.d.ts +269 -0
  76. package/dist/minds.js +193 -0
  77. package/dist/relays-enrollment.d.ts +33 -0
  78. package/dist/relays-enrollment.js +115 -0
  79. package/dist/runner-grant.d.ts +10 -0
  80. package/dist/runner-grant.js +133 -0
  81. package/dist/runner.d.ts +68 -0
  82. package/dist/runner.js +116 -0
  83. package/dist/types.d.ts +87 -0
  84. package/dist/types.js +1 -0
  85. package/dist/urls.d.ts +6 -0
  86. package/dist/urls.js +31 -0
  87. package/package.json +46 -3
@@ -0,0 +1,206 @@
1
+ import { selectGenesisContext } from './context.js';
2
+ import { mindsModule } from './minds.js';
3
+ import { foundryBilling } from './foundry-billing.js';
4
+ import { relaysEnrollment } from './relays-enrollment.js';
5
+ import { blindsModule } from './blinds-owner-enrollment.js';
6
+ import { beaconsModule } from './beacons.js';
7
+ import { dialsModule } from './dials.js';
8
+ import { GenesisClient } from './client.js';
9
+ import { henryModule } from './henry.js';
10
+ import { fleetsModule } from './fleets.js';
11
+ import { flocksModule } from './flocks.js';
12
+ import { rigsModule, panesModule, shellsModule } from './instances.js';
13
+ import { gearsModule } from './gears.js';
14
+ import { lanesModule } from './lanes.js';
15
+ import { flaresModule } from './flares.js';
16
+ import { hivesUploadBody } from './hives-upload.js';
17
+ import { runnerModule } from './runner.js';
18
+ import { hivesOperations } from './hives-operations.js';
19
+ import { hivesMarketplace } from './hives-marketplace.js';
20
+ import { hivesVolumes } from './hives-volumes.js';
21
+ import { hivesInvokeHeaders, hivesOperationStatus } from './hives-functions.js';
22
+ /**
23
+ * The Genesis SDK: one client, every service.
24
+ * const genesis = new Genesis(); // GENESIS_API_KEY or `genesis login`
25
+ * await genesis.hives.projects.list();
26
+ * await genesis.foundry.chat({ model: 'x', messages: [{ role: 'user', content: 'hi' }] });
27
+ */
28
+ export class Genesis extends GenesisClient {
29
+ constructor(opts = {}) { super(opts); }
30
+ /** Generic escape hatch: genesis.call('hives_list_projects', {...}) */
31
+ call = this.request.bind(this);
32
+ context = { select: (selection, options = {}) => selectGenesisContext(selection, { credential: () => this.credential(), fetch: this.contextFetch, signal: options.signal }) };
33
+ minds = mindsModule(this);
34
+ blinds = blindsModule(this);
35
+ dials = dialsModule(this);
36
+ henry = henryModule(this);
37
+ fleets = fleetsModule(this);
38
+ runner = runnerModule(this);
39
+ beacons = beaconsModule(this);
40
+ flocks = flocksModule(this);
41
+ rigs = rigsModule(this);
42
+ panes = panesModule(this);
43
+ shells = shellsModule(this);
44
+ gears = gearsModule(this);
45
+ lanes = lanesModule(this);
46
+ flares = flaresModule(this);
47
+ foundry = {
48
+ billing: foundryBilling(this),
49
+ models: {
50
+ list: () => this.request('foundry_listModels'),
51
+ },
52
+ /** OpenAI-compatible chat completion (non-streaming). */
53
+ chat: (body) => this.request('foundry_createChatCompletion', { body: { ...body, stream: false } }),
54
+ /** Streaming chat: yields content deltas parsed from the SSE stream. */
55
+ chatStream: (body) => this.streamChat(body),
56
+ embeddings: (body) => this.request('foundry_createEmbedding', { body }),
57
+ registry: {
58
+ models: (q = {}) => this.request('foundry_listRegistryModels', q),
59
+ model: (canonical_model_id) => this.request('foundry_getRegistryModel', { canonical_model_id }),
60
+ },
61
+ };
62
+ hives = {
63
+ ...hivesOperations(this),
64
+ volumes: hivesVolumes(this),
65
+ marketplace: hivesMarketplace(this),
66
+ /** The gateway resolves the current authorized selection from an interactive One account session. */
67
+ context: {
68
+ get: () => this.request('hives_get_context_project'),
69
+ set: (body) => this.request('hives_set_context_project', { body }),
70
+ /** Detach this selection; the service project and customer resources are retained. */
71
+ detach: () => this.request('hives_detach_context_project'),
72
+ },
73
+ environment: {
74
+ list: (project_id, q = {}) => this.request('hives_list_project_environment', { ...q, project_id }),
75
+ upsert: (project_id, body) => this.request('hives_update_project_environment', { project_id, body }),
76
+ /** Explicit KMS reveal with a persisted names-only audit. Do not log the plaintext. */
77
+ reveal: (project_id, key) => this.request('hives_reveal_project_environment', { project_id, key }),
78
+ },
79
+ projects: {
80
+ list: (q = {}) => this.request('hives_list_projects', q),
81
+ get: (project_id) => this.request('hives_get_project', { project_id }),
82
+ create: (body) => this.request('hives_create_project', { body }),
83
+ update: (project_id, body) => this.request('hives_update_project', { project_id, body }),
84
+ activity: (project_id, q = {}) => this.request('hives_get_project_activity', { ...q, project_id }),
85
+ delete: (project_id) => this.request('hives_delete_project', { project_id }),
86
+ },
87
+ secrets: {
88
+ list: (project_id, q = {}) => this.request('hives_list_secrets', { ...q, project_id }),
89
+ get: (project_id, secret_id) => this.request('hives_get_secret', { project_id, secret_id }),
90
+ create: (project_id, body) => this.request('hives_create_secret', { project_id, body }),
91
+ update: (project_id, secret_id, body) => this.request('hives_update_secret', { project_id, secret_id, body }),
92
+ delete: (project_id, secret_id) => this.request('hives_delete_secret', { project_id, secret_id }),
93
+ /** Explicit sensitive operation. Do not log or retain the returned plaintext. */
94
+ reveal: (project_id, secret_id) => this.request('hives_reveal_secret', { project_id, secret_id }),
95
+ bulkUpsert: (project_id, body) => this.request('hives_bulk_upsert_secrets', { project_id, body }),
96
+ },
97
+ deployments: {
98
+ list: (project_id, q = {}) => this.request('hives_list_deployments', { ...q, project_id }),
99
+ get: (project_id, deployment_id) => this.request('hives_get_deployment', { project_id, deployment_id }),
100
+ upload: async (project_id, file, options = {}) => this.request('hives_upload_deployment', { project_id, body: await hivesUploadBody(file, options) }),
101
+ create: (project_id, body) => this.request('hives_create_deployment', { project_id, body }),
102
+ promote: (project_id, deployment_id) => this.request('hives_promote_deployment', { project_id, deployment_id }),
103
+ rollback: (project_id, deployment_id, body = {}) => this.request('hives_rollback_deployment', { project_id, deployment_id, body }),
104
+ cancel: (project_id, deployment_id) => this.request('hives_cancel_deployment', { project_id, deployment_id }),
105
+ stop: (project_id, deployment_id, init = {}) => this.request('hives_stop_deployment', { project_id, deployment_id }, init),
106
+ delete: (project_id, deployment_id) => this.request('hives_delete_deployment', { project_id, deployment_id }),
107
+ logs: (project_id, deployment_id, q = {}) => this.request('hives_query_deployment_logs', { ...q, project_id, deployment_id }),
108
+ invoke: (project_id, deployment_id, body = {}, init = {}) => this.raw('hives_invoke_deployment', { project_id, deployment_id, body }, init),
109
+ },
110
+ functions: {
111
+ list: (project_id, q = {}) => this.request('hives_list_functions', { ...q, project_id }),
112
+ get: (project_id, function_id) => this.request('hives_get_function', { project_id, function_id }),
113
+ create: (project_id, body) => this.request('hives_create_function', { project_id, body }),
114
+ update: (project_id, function_id, body) => this.request('hives_update_function', { project_id, function_id, body }),
115
+ delete: (project_id, function_id) => this.request('hives_delete_function', { project_id, function_id }),
116
+ /** Completed raw guest response; parse text/JSON/bytes explicitly. Never follows redirects. */
117
+ invoke: (project_id, function_id, body = {}, init = {}) => this.raw('hives_invoke_function', { project_id, function_id, body }, { signal: init.signal, headers: hivesInvokeHeaders(init) }),
118
+ operations: {
119
+ get: async (project_id, function_id, operation_id, init = {}) => hivesOperationStatus(await this.request('hives_get_function_operation', { project_id, function_id, operation_id }, init), operation_id),
120
+ release: async (project_id, function_id, operation_id, init = {}) => hivesOperationStatus(await this.request('hives_release_function_operation', { project_id, function_id, operation_id }, init), operation_id),
121
+ },
122
+ },
123
+ regions: { list: () => this.request('hives_list_regions') },
124
+ };
125
+ silos = {
126
+ /** Internal resource UUIDs; organization and parent ownership are enforced by Silos. */
127
+ databases: {
128
+ list: (project_id) => this.request('silos_listDatabases', { project_id }),
129
+ get: (project_id, database_id) => this.request('silos_getDatabase', { project_id, database_id }),
130
+ },
131
+ projects: {
132
+ list: () => this.request('silos_listProjects'),
133
+ create: (body) => this.request('silos_createProject', { body }),
134
+ get: (project_id) => this.request('silos_getProject', { project_id }),
135
+ },
136
+ };
137
+ traces = {
138
+ runs: {
139
+ create: (body, idempotencyKey) => this.request('traces_createRun', { body }, { headers: { 'idempotency-key': idempotencyKey } }),
140
+ list: (q = {}) => this.request('traces_listRuns', q),
141
+ get: (id) => this.request('traces_getRun', { id }),
142
+ evidence: (id) => this.request('traces_getRunEvidence', { id }),
143
+ },
144
+ search: (body, idempotencyKey) => this.request('traces_search', { body }, { headers: { 'idempotency-key': idempotencyKey } }),
145
+ usage: { events: () => this.request('traces_listUsageEvents') },
146
+ };
147
+ relays = {
148
+ enrollment: relaysEnrollment(this),
149
+ zones: {
150
+ list: (q = {}) => this.request('relays_listZones', q),
151
+ get: (zone) => this.request('relays_getZone', { zone }),
152
+ dnssec: (zone) => this.request('relays_getDnssec', { zone }),
153
+ create: (body) => this.request('relays_createZone', { body }),
154
+ delete: (zone) => this.request('relays_deleteZone', { zone }),
155
+ },
156
+ records: {
157
+ list: (zone, q = {}) => this.request('relays_listRecords', { zone, ...q }),
158
+ create: (zone, body) => this.request('relays_createRecord', { zone, body }),
159
+ update: (zone, recordId, body) => this.request('relays_updateRecord', { zone, recordId, body }),
160
+ delete: (zone, recordId) => this.request('relays_deleteRecord', { zone, recordId }),
161
+ },
162
+ };
163
+ /** One account org API keys (WorkOS). custody 'blinds' = key goes straight to Blinds, never shown. */
164
+ keys = {
165
+ list: (org_id) => this.request('iam_listOrgApiKeys', { org_id }),
166
+ create: (org_id, body) => this.request('iam_createOrgApiKey', { org_id, body }),
167
+ revoke: (key_id) => this.request('iam_revokeApiKey', { key_id }),
168
+ };
169
+ /** Who is this credential? (One account verify: org, principal, scopes, kind) */
170
+ async whoami() {
171
+ const credential_value = await this.credential();
172
+ if (!credential_value)
173
+ throw new Error('No Genesis credential. Run `genesis login`, or set GENESIS_API_KEY.');
174
+ return this.request('iam_verifyCredential', { body: { credential_value } });
175
+ }
176
+ async *streamChat(body) {
177
+ const res = await this.raw('foundry_createChatCompletion', { body: { ...body, stream: true } }, { headers: { accept: 'text/event-stream' } });
178
+ if (!res.body)
179
+ return;
180
+ const reader = res.body.getReader();
181
+ const dec = new TextDecoder();
182
+ let buf = '';
183
+ for (;;) {
184
+ const { done, value } = await reader.read();
185
+ if (done)
186
+ break;
187
+ buf += dec.decode(value, { stream: true });
188
+ let i;
189
+ while ((i = buf.indexOf('\n')) >= 0) {
190
+ const line = buf.slice(0, i).trim();
191
+ buf = buf.slice(i + 1);
192
+ if (!line.startsWith('data:'))
193
+ continue;
194
+ const data = line.slice(5).trim();
195
+ if (data === '[DONE]')
196
+ return;
197
+ try {
198
+ const d = JSON.parse(data).choices?.[0]?.delta?.content;
199
+ if (d)
200
+ yield d;
201
+ }
202
+ catch { /* ignore keepalives */ }
203
+ }
204
+ }
205
+ }
206
+ }