@onesi/genesis-cli 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 (93) hide show
  1. package/README.md +64 -0
  2. package/bin/genesis.js +3 -0
  3. package/dist/auth.d.ts +30 -0
  4. package/dist/auth.js +273 -0
  5. package/dist/beacons.d.ts +3 -0
  6. package/dist/beacons.js +162 -0
  7. package/dist/device-login.d.ts +25 -0
  8. package/dist/device-login.js +173 -0
  9. package/dist/dials.d.ts +7 -0
  10. package/dist/dials.js +99 -0
  11. package/dist/fleets.d.ts +4 -0
  12. package/dist/fleets.js +102 -0
  13. package/dist/flocks.d.ts +9 -0
  14. package/dist/flocks.js +326 -0
  15. package/dist/function-input.d.ts +3 -0
  16. package/dist/function-input.js +49 -0
  17. package/dist/henry.d.ts +7 -0
  18. package/dist/henry.js +85 -0
  19. package/dist/hives-coverage.d.ts +12 -0
  20. package/dist/hives-coverage.js +116 -0
  21. package/dist/hives-marketplace.d.ts +10 -0
  22. package/dist/hives-marketplace.js +29 -0
  23. package/dist/hives-node-transport.d.ts +6 -0
  24. package/dist/hives-node-transport.js +150 -0
  25. package/dist/hives-operations.d.ts +10 -0
  26. package/dist/hives-operations.js +63 -0
  27. package/dist/hives-platform.d.ts +13 -0
  28. package/dist/hives-platform.js +133 -0
  29. package/dist/hives-resources.d.ts +9 -0
  30. package/dist/hives-resources.js +94 -0
  31. package/dist/iam-directory.d.ts +15 -0
  32. package/dist/iam-directory.js +71 -0
  33. package/dist/index.d.ts +23 -0
  34. package/dist/index.js +872 -0
  35. package/dist/lifeid-native.d.ts +24 -0
  36. package/dist/lifeid-native.js +113 -0
  37. package/dist/minds-owner.d.ts +3 -0
  38. package/dist/minds-owner.js +42 -0
  39. package/dist/minds.d.ts +3 -0
  40. package/dist/minds.js +125 -0
  41. package/dist/onboard/art.d.ts +50 -0
  42. package/dist/onboard/art.js +139 -0
  43. package/dist/onboard/brand.d.ts +56 -0
  44. package/dist/onboard/brand.js +134 -0
  45. package/dist/onboard/caps.d.ts +90 -0
  46. package/dist/onboard/caps.js +232 -0
  47. package/dist/onboard/encode.d.ts +23 -0
  48. package/dist/onboard/encode.js +235 -0
  49. package/dist/onboard/eye.d.ts +103 -0
  50. package/dist/onboard/eye.js +147 -0
  51. package/dist/onboard/index.d.ts +61 -0
  52. package/dist/onboard/index.js +562 -0
  53. package/dist/onboard/mcp.d.ts +35 -0
  54. package/dist/onboard/mcp.js +118 -0
  55. package/dist/onboard/raster.d.ts +43 -0
  56. package/dist/onboard/raster.js +253 -0
  57. package/dist/onboard/sound.d.ts +2 -0
  58. package/dist/onboard/sound.js +54 -0
  59. package/dist/onboard/state.d.ts +24 -0
  60. package/dist/onboard/state.js +48 -0
  61. package/dist/onboard/term.d.ts +69 -0
  62. package/dist/onboard/term.js +292 -0
  63. package/dist/onboard/ui.d.ts +97 -0
  64. package/dist/onboard/ui.js +615 -0
  65. package/dist/orgs.d.ts +16 -0
  66. package/dist/orgs.js +89 -0
  67. package/dist/output.d.ts +28 -0
  68. package/dist/output.js +46 -0
  69. package/dist/products.d.ts +18 -0
  70. package/dist/products.js +311 -0
  71. package/dist/relays-commands/certificates.d.ts +3 -0
  72. package/dist/relays-commands/certificates.js +20 -0
  73. package/dist/relays-commands/domains.d.ts +3 -0
  74. package/dist/relays-commands/domains.js +23 -0
  75. package/dist/relays-commands/index.d.ts +4 -0
  76. package/dist/relays-commands/index.js +10 -0
  77. package/dist/relays-commands/monitoring.d.ts +3 -0
  78. package/dist/relays-commands/monitoring.js +41 -0
  79. package/dist/relays-commands/telemetry.d.ts +3 -0
  80. package/dist/relays-commands/telemetry.js +28 -0
  81. package/dist/relays-commands/zones.d.ts +5 -0
  82. package/dist/relays-commands/zones.js +9 -0
  83. package/dist/relays-enrollment.d.ts +3 -0
  84. package/dist/relays-enrollment.js +7 -0
  85. package/dist/runner.d.ts +4 -0
  86. package/dist/runner.js +57 -0
  87. package/dist/secret-input.d.ts +14 -0
  88. package/dist/secret-input.js +85 -0
  89. package/dist/store.d.ts +39 -0
  90. package/dist/store.js +33 -0
  91. package/dist/wasm-input.d.ts +2 -0
  92. package/dist/wasm-input.js +31 -0
  93. package/package.json +54 -1
@@ -0,0 +1,41 @@
1
+ /** `genesis relays ...` words for the monitoring family (openapi/specs/relays/monitoring.openapi.yaml). */
2
+ export const monitoringCommands = {
3
+ 'monitors list': 'relays_listMonitors',
4
+ 'monitors create': 'relays_createMonitor',
5
+ 'monitors get': 'relays_getMonitor',
6
+ 'monitors update': 'relays_updateMonitor',
7
+ 'monitors delete': 'relays_deleteMonitor',
8
+ 'monitors checks': 'relays_listMonitorChecks',
9
+ 'monitors pause': 'relays_pauseMonitor',
10
+ 'monitors resume': 'relays_resumeMonitor',
11
+ 'monitors test': 'relays_testMonitor',
12
+ 'monitors slos list': 'relays_listMonitorSlos',
13
+ 'monitors slos create': 'relays_createMonitorSlo',
14
+ 'monitors slos burn-rate': 'relays_getMonitorSloBurnRates',
15
+ 'incidents list': 'relays_listIncidents',
16
+ 'incidents create': 'relays_createIncident',
17
+ 'incidents analytics': 'relays_getIncidentAnalytics',
18
+ 'incidents get': 'relays_getIncident',
19
+ 'incidents update': 'relays_updateIncident',
20
+ 'incidents delete': 'relays_deleteIncident',
21
+ 'oncall coverage': 'relays_getOncallCoverage',
22
+ 'oncall schedules list': 'relays_listOncallSchedules',
23
+ 'oncall schedules create': 'relays_createOncallSchedule',
24
+ 'oncall schedules get': 'relays_getOncallSchedule',
25
+ 'oncall schedules update': 'relays_updateOncallSchedule',
26
+ 'oncall schedules delete': 'relays_deleteOncallSchedule',
27
+ 'status-pages list': 'relays_listStatusPages',
28
+ 'status-pages create': 'relays_createStatusPage',
29
+ 'status-pages get': 'relays_getStatusPage',
30
+ 'status-pages update': 'relays_updateStatusPage',
31
+ 'status-pages delete': 'relays_deleteStatusPage',
32
+ 'status-pages components list': 'relays_listStatusPageComponents',
33
+ 'status-pages components create': 'relays_createStatusPageComponent',
34
+ 'status-pages components update': 'relays_updateStatusPageComponent',
35
+ 'status-pages components delete': 'relays_deleteStatusPageComponent',
36
+ 'status-pages component-groups delete': 'relays_deleteStatusPageComponentGroup',
37
+ 'status-pages incidents list': 'relays_listStatusPageIncidents',
38
+ 'status-pages incidents create': 'relays_createStatusPageIncident',
39
+ 'status-pages subscribers list': 'relays_listStatusPageSubscribers',
40
+ 'status-pages subscribers delete': 'relays_deleteStatusPageSubscriber',
41
+ };
@@ -0,0 +1,3 @@
1
+ import type { OperationId } from '@onesi/genesis';
2
+ /** `genesis relays ...` words for the telemetry family (openapi/specs/relays/telemetry.openapi.yaml). */
3
+ export declare const telemetryCommands: Readonly<Record<string, OperationId>>;
@@ -0,0 +1,28 @@
1
+ /** `genesis relays ...` words for the telemetry family (openapi/specs/relays/telemetry.openapi.yaml). */
2
+ export const telemetryCommands = {
3
+ 'logs list': 'relays_listLogs',
4
+ 'logs patterns list': 'relays_listLogPatterns',
5
+ 'logs patterns alert': 'relays_dispatchLogPatternAlerts',
6
+ 'logs policies list': 'relays_listLogPatternPolicies',
7
+ 'logs policies create': 'relays_createLogPatternPolicy',
8
+ 'logs policies evaluate': 'relays_evaluateLogPatternPolicy',
9
+ 'logs retention get': 'relays_getLogRetention',
10
+ 'logs retention set': 'relays_setLogRetention',
11
+ 'audit-logs list': 'relays_listAuditLogs',
12
+ 'audit-logs export': 'relays_exportAuditLogs',
13
+ 'traces list': 'relays_listTraces',
14
+ 'analytics get': 'relays_getAnalytics',
15
+ 'errors projects list': 'relays_listErrorProjects',
16
+ 'errors projects create': 'relays_createErrorProject',
17
+ 'errors events send': 'relays_ingestErrorEvent',
18
+ 'errors issues list': 'relays_listErrorIssues',
19
+ 'errors issues update': 'relays_updateErrorIssue',
20
+ 'errors issues context': 'relays_getErrorIssueContext',
21
+ 'errors integrations list': 'relays_listErrorIssueIntegrations',
22
+ 'errors integrations link': 'relays_linkErrorIssueIntegration',
23
+ 'errors artifacts list': 'relays_listErrorArtifacts',
24
+ 'errors artifacts create': 'relays_createErrorArtifact',
25
+ 'errors deployments list': 'relays_listErrorDeployments',
26
+ 'errors deployments create': 'relays_createErrorDeployment',
27
+ 'errors releases list': 'relays_listErrorReleases',
28
+ };
@@ -0,0 +1,5 @@
1
+ import type { OperationId } from '@onesi/genesis';
2
+ /** `genesis relays ...` words for the zones family (openapi/specs/relays/zones.openapi.yaml).
3
+ * DNSSEC disable is `disable-dnssec`, beside the hand-written `dnssec <zone>` read and the
4
+ * `create-zone` / `delete-zone` commands, so it does not shadow `dnssec <zone>`. */
5
+ export declare const zonesCommands: Readonly<Record<string, OperationId>>;
@@ -0,0 +1,9 @@
1
+ /** `genesis relays ...` words for the zones family (openapi/specs/relays/zones.openapi.yaml).
2
+ * DNSSEC disable is `disable-dnssec`, beside the hand-written `dnssec <zone>` read and the
3
+ * `create-zone` / `delete-zone` commands, so it does not shadow `dnssec <zone>`. */
4
+ export const zonesCommands = {
5
+ 'caa list': 'relays_listCaaRecords',
6
+ 'caa create': 'relays_createCaaRecord',
7
+ 'disable-dnssec': 'relays_disableDnssec',
8
+ 'nameservers list': 'relays_listNameservers',
9
+ };
@@ -0,0 +1,3 @@
1
+ import type { Command } from 'commander';
2
+ import type { Genesis } from '@onesi/genesis';
3
+ export declare function registerRelaysEnrollment(relays: Command, client: () => Promise<Genesis>, emit: (value: unknown, pretty: () => string) => void): void;
@@ -0,0 +1,7 @@
1
+ export function registerRelaysEnrollment(relays, client, emit) {
2
+ const enrollment = relays.command('enrollment').description('Explicit empty Relays account for the current verified human selection');
3
+ for (const action of ['get', 'activate'])
4
+ enrollment.command(action).allowExcessArguments(false)
5
+ .description(action === 'get' ? 'Read status without creating an account' : 'Activate once; read status after any unconfirmed response')
6
+ .action(async () => { const value = await (await client()).relays.enrollment[action](); emit(value, () => JSON.stringify(value, null, 2)); });
7
+ }
@@ -0,0 +1,4 @@
1
+ import type { Command } from 'commander';
2
+ import type { Genesis } from '@onesi/genesis';
3
+ /** Register only Runner commands. The authenticated credential determines org and subject. */
4
+ export declare function registerRunner(program: Command, client: () => Promise<Genesis>, emit: (data: unknown, pretty: () => string) => void): void;
package/dist/runner.js ADDED
@@ -0,0 +1,57 @@
1
+ /** Register only Runner commands. The authenticated credential determines org and subject. */
2
+ export function registerRunner(program, client, emit) {
3
+ const runner = program.command('runner').description('Runner: agent task execution');
4
+ const output = (value) => emit(value, () => JSON.stringify(value, null, 2));
5
+ runner.command('permission-grant').description('Request only your current native human Sandbox execution permission; preserve operation/scope/expiry on retry')
6
+ .requiredOption('--organization <id>', 'current approved Life organization assertion')
7
+ .requiredOption('--project <id>', 'current approved project assertion')
8
+ .requiredOption('--workspace <id>', 'current approved workspace assertion')
9
+ .requiredOption('--operation-id <uuid>', 'stable canonical UUIDv4 for this immutable authorization operation')
10
+ .requiredOption('--request-id <uuid>', 'fresh canonical UUIDv4 correlation for this attempt')
11
+ .requiredOption('--expires-at-ms <ms>', 'exact retained future integer expiry, at most 30 minutes and current session/access expiry')
12
+ .action(async (o) => {
13
+ if (!/^[1-9]\d*$/.test(o.expiresAtMs) || !Number.isSafeInteger(Number(o.expiresAtMs)))
14
+ throw new TypeError('Runner permission expiry must be a positive safe integer literal');
15
+ const input = { schemaVersion: 1, organizationId: o.organization, projectId: o.project,
16
+ workspaceId: o.workspace, platformId: 'pf_console', fleetId: null, resourceEnvironment: 'sandbox',
17
+ operationId: o.operationId, requestId: o.requestId, expiresAtMs: Number(o.expiresAtMs) };
18
+ output(await (await client()).runner.permission.grant(input));
19
+ });
20
+ runner.command('catalog').description('Authorized workspaces and execution routes')
21
+ .action(async () => output(await (await client()).runner.catalog()));
22
+ const jobs = runner.command('jobs').description('Jobs belonging to your verified identity');
23
+ jobs.command('list', { isDefault: true }).description('Newest 100 jobs')
24
+ .action(async () => output(await (await client()).runner.jobs.list()));
25
+ jobs.command('start').description('Start a bounded task; refs must come from catalog')
26
+ .requiredOption('--task-id <id>', 'opaque task ID')
27
+ .requiredOption('--text <text>', 'task instructions (at most 32768 characters)')
28
+ .requiredOption('--workspace <ref>', 'authorized workspace key')
29
+ .requiredOption('--kind <kind>', 'external-harness or internal-model')
30
+ .requiredOption('--route <id>', 'authorized execution route')
31
+ .requiredOption('--idempotency-key <key>', 'stable key for retries of the same task')
32
+ .option('--duration-ms <ms>', 'maximum execution duration', '600000')
33
+ .option('--output-bytes <bytes>', 'maximum output size', '1048576')
34
+ .option('--max-events <count>', 'retained event limit', '200')
35
+ .action(async (o) => {
36
+ if (!['external-harness', 'internal-model'].includes(o.kind))
37
+ throw new TypeError('Runner kind must be external-harness or internal-model');
38
+ const body = {
39
+ task: { id: o.taskId, text: o.text }, workspaceRef: o.workspace,
40
+ executionRef: { kind: o.kind, routeId: o.route },
41
+ limits: { maxDurationMs: Number(o.durationMs), maxOutputBytes: Number(o.outputBytes), maxEvents: Number(o.maxEvents) },
42
+ idempotencyKey: o.idempotencyKey,
43
+ };
44
+ output(await (await client()).runner.jobs.start(body));
45
+ });
46
+ jobs.command('get <job_id>').description('Read the authoritative snapshot')
47
+ .action(async (id) => output(await (await client()).runner.jobs.get(id)));
48
+ jobs.command('events <job_id>').description('Read one event page; continue with nextAfterSeq while hasMore')
49
+ .option('--after-seq <seq>', 'exclusive event cursor', '0')
50
+ .action(async (id, o) => output(await (await client()).runner.jobs.events(id, Number(o.afterSeq))));
51
+ jobs.command('result <job_id>').description('Read the verified completed provider deliverable')
52
+ .action(async (id) => output(await (await client()).runner.jobs.result(id)));
53
+ jobs.command('cancel <job_id>').description('Request cancellation; then watch status and cleanupPending')
54
+ .action(async (id) => output(await (await client()).runner.jobs.cancel(id)));
55
+ jobs.command('delete <job_id>').description('Delete a finished job and its events (active or cleanup-pending jobs return E_JOB_ACTIVE)')
56
+ .action(async (id) => output(await (await client()).runner.jobs.delete(id)));
57
+ }
@@ -0,0 +1,14 @@
1
+ export interface SecretInputOptions {
2
+ file?: string;
3
+ stdin?: boolean;
4
+ }
5
+ export interface SecretInput {
6
+ name: string;
7
+ value: string;
8
+ description?: string;
9
+ }
10
+ /** Read plaintext only from an explicitly selected file or stdin, never argv. */
11
+ export declare function readSecretInput(options: SecretInputOptions, limit: number): Promise<string>;
12
+ export declare function validateSecretValue(value: string): string;
13
+ export declare function validateSecret(input: unknown): SecretInput;
14
+ export declare function parseSecretBatch(text: string): SecretInput[];
@@ -0,0 +1,85 @@
1
+ import { open } from 'node:fs/promises';
2
+ /** Read plaintext only from an explicitly selected file or stdin, never argv. */
3
+ export async function readSecretInput(options, limit) {
4
+ if (Boolean(options.file) === Boolean(options.stdin))
5
+ throw new Error('Choose exactly one input source: a file or --stdin. Secret values are not accepted as command arguments.');
6
+ const chunks = [];
7
+ let size = 0;
8
+ const append = (chunk) => {
9
+ size += chunk.byteLength;
10
+ if (size > limit)
11
+ throw new Error(`Secret input exceeds ${limit} UTF-8 bytes. Use a smaller value or batch.`);
12
+ chunks.push(chunk);
13
+ };
14
+ if (options.file) {
15
+ let file;
16
+ try {
17
+ file = await open(options.file, 'r');
18
+ }
19
+ catch {
20
+ throw new Error('Could not open the secret input file. Check its path and permissions.');
21
+ }
22
+ try {
23
+ for (;;) {
24
+ const buffer = new Uint8Array(Math.min(8192, limit + 1));
25
+ const { bytesRead } = await file.read(buffer, 0, buffer.length, null);
26
+ if (!bytesRead)
27
+ break;
28
+ append(buffer.subarray(0, bytesRead));
29
+ }
30
+ }
31
+ finally {
32
+ await file.close();
33
+ }
34
+ }
35
+ else {
36
+ for await (const chunk of process.stdin)
37
+ append(typeof chunk === 'string' ? new TextEncoder().encode(chunk) : chunk);
38
+ }
39
+ const bytes = new Uint8Array(size);
40
+ let offset = 0;
41
+ for (const chunk of chunks) {
42
+ bytes.set(chunk, offset);
43
+ offset += chunk.byteLength;
44
+ }
45
+ try {
46
+ return new TextDecoder('utf-8', { fatal: true }).decode(bytes);
47
+ }
48
+ catch {
49
+ throw new Error('Secret input must be valid UTF-8 text.');
50
+ }
51
+ }
52
+ export function validateSecretValue(value) {
53
+ if (!value.length || new TextEncoder().encode(value).length > 65536)
54
+ throw new Error('Secret values must contain 1–65,536 UTF-8 bytes.');
55
+ return value;
56
+ }
57
+ export function validateSecret(input) {
58
+ if (!input || typeof input !== 'object')
59
+ throw new Error('Each secret needs a name and value.');
60
+ const { name, value, description } = input;
61
+ if (typeof name !== 'string' || name.length > 255 || !/^[A-Za-z][A-Za-z0-9_]*$/.test(name))
62
+ throw new Error('Secret names must start with a letter and contain only letters, numbers and underscores (up to 255 characters).');
63
+ if (typeof value !== 'string')
64
+ throw new Error('Each secret value must be a string.');
65
+ if (description !== undefined && description !== null && (typeof description !== 'string' || description.length > 500))
66
+ throw new Error('Secret descriptions must contain at most 500 characters.');
67
+ return { name, value: validateSecretValue(value), ...(typeof description === 'string' ? { description } : {}) };
68
+ }
69
+ export function parseSecretBatch(text) {
70
+ let data;
71
+ try {
72
+ data = JSON.parse(text);
73
+ }
74
+ catch {
75
+ throw new Error('Bulk input must be a JSON array with secret name and value fields.');
76
+ }
77
+ if (!Array.isArray(data) || !data.length)
78
+ throw new Error('Bulk input must be a non-empty JSON array.');
79
+ const batch = data.map(validateSecret);
80
+ if (new Set(batch.map((secret) => secret.name)).size !== batch.length)
81
+ throw new Error('Each secret name must appear once in a bulk update.');
82
+ if (new TextEncoder().encode(JSON.stringify(batch)).length > 256 * 1024)
83
+ throw new Error('Bulk input must fit within 256 KiB. Split it into smaller batches.');
84
+ return batch;
85
+ }
@@ -0,0 +1,39 @@
1
+ /** Saved `genesis login`: kept in the OS keychain (macOS Keychain, Windows Credential Manager, libsecret). */
2
+ export interface SavedLogin {
3
+ access_token: string;
4
+ refresh_token?: string;
5
+ user?: {
6
+ id: string;
7
+ email?: string;
8
+ first_name?: string | null;
9
+ last_name?: string | null;
10
+ };
11
+ organization_id?: string;
12
+ /** epoch seconds, from the access token's exp claim */
13
+ expires_at?: number;
14
+ client_id: string;
15
+ /** One account provenance: the native bridge, or the RFC 8628 device grant. Legacy raw AuthKit credentials are never reused. */
16
+ auth?: {
17
+ kind: 'lifeid-bridge';
18
+ issuer: string;
19
+ audience: string;
20
+ product_id: string;
21
+ redirect_uri: string;
22
+ principal_id: string;
23
+ session_id: string;
24
+ } | {
25
+ kind: 'lifeid-device';
26
+ issuer: string;
27
+ client_id: string;
28
+ principal_id: string;
29
+ session_id: string;
30
+ };
31
+ }
32
+ export interface CredentialStore {
33
+ get(): Promise<SavedLogin | undefined>;
34
+ set(v: SavedLogin): Promise<void>;
35
+ clear(): Promise<boolean>;
36
+ readonly kind: string;
37
+ }
38
+ export declare function keychainStore(): Promise<CredentialStore>;
39
+ export declare function memoryStore(initial?: SavedLogin): CredentialStore;
package/dist/store.js ADDED
@@ -0,0 +1,33 @@
1
+ const SERVICE = 'one.life.genesis';
2
+ const ACCOUNT = 'default';
3
+ export async function keychainStore() {
4
+ let Entry;
5
+ try {
6
+ ({ Entry } = await import('@napi-rs/keyring'));
7
+ }
8
+ catch {
9
+ throw new Error('OS keychain is unavailable (@napi-rs/keyring not installed). Use GENESIS_API_KEY instead.');
10
+ }
11
+ const entry = new Entry(SERVICE, ACCOUNT);
12
+ return {
13
+ kind: 'os-keychain',
14
+ async get() { try {
15
+ const s = entry.getPassword();
16
+ return s ? JSON.parse(s) : undefined;
17
+ }
18
+ catch {
19
+ return undefined;
20
+ } },
21
+ async set(v) { entry.setPassword(JSON.stringify(v)); },
22
+ async clear() { try {
23
+ return entry.deletePassword();
24
+ }
25
+ catch {
26
+ return false;
27
+ } },
28
+ };
29
+ }
30
+ export function memoryStore(initial) {
31
+ let v = initial;
32
+ return { kind: 'memory', async get() { return v; }, async set(x) { v = x; }, async clear() { const had = !!v; v = undefined; return had; } };
33
+ }
@@ -0,0 +1,2 @@
1
+ /** Read only the explicitly requested regular file, with a bounded allocation. */
2
+ export declare function readWasmFile(path: string): Promise<Blob>;
@@ -0,0 +1,31 @@
1
+ import { open } from 'node:fs/promises';
2
+ import { MAX_WASM_BYTES } from '@onesi/genesis';
3
+ /** Read only the explicitly requested regular file, with a bounded allocation. */
4
+ export async function readWasmFile(path) {
5
+ let file;
6
+ try {
7
+ file = await open(path, 'r');
8
+ }
9
+ catch {
10
+ throw new Error('Could not open the WASM file. Check its path and permissions.');
11
+ }
12
+ try {
13
+ const stat = await file.stat();
14
+ if (!stat.isFile() || stat.size < 4 || stat.size > MAX_WASM_BYTES)
15
+ throw new Error('Choose a regular WASM file of 4 bytes to 10 MiB.');
16
+ const bytes = new Uint8Array(MAX_WASM_BYTES + 1);
17
+ let size = 0;
18
+ for (;;) {
19
+ const { bytesRead } = await file.read(bytes, size, bytes.length - size, null);
20
+ if (!bytesRead)
21
+ break;
22
+ size += bytesRead;
23
+ if (size > MAX_WASM_BYTES)
24
+ throw new Error('WASM file exceeds 10 MiB.');
25
+ }
26
+ return new Blob([bytes.slice(0, size)], { type: 'application/wasm' });
27
+ }
28
+ finally {
29
+ await file.close();
30
+ }
31
+ }
package/package.json CHANGED
@@ -1 +1,54 @@
1
- {"name":"@onesi/genesis-cli","version":"0.0.1-stage","description":"Reserved for the OneOS Genesis SDK"}
1
+ {
2
+ "name": "@onesi/genesis-cli",
3
+ "version": "0.2.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/l1felabs/genesis-api.git",
7
+ "directory": "packages/cli"
8
+ },
9
+ "description": "genesis: one CLI for every Genesis service",
10
+ "type": "module",
11
+ "bin": {
12
+ "genesis": "bin/genesis.js"
13
+ },
14
+ "keywords": [
15
+ "genesis",
16
+ "oneos",
17
+ "sdk",
18
+ "cli",
19
+ "mcp",
20
+ "model-context-protocol",
21
+ "ai-agents",
22
+ "api"
23
+ ],
24
+ "author": "One Superintelligence, Inc.",
25
+ "homepage": "https://os.one.ml/docs",
26
+ "engines": {
27
+ "node": ">=20.19"
28
+ },
29
+ "files": [
30
+ "bin",
31
+ "dist"
32
+ ],
33
+ "dependencies": {
34
+ "commander": "^14.0.0",
35
+ "undici": "6.29.0",
36
+ "@onesi/genesis": "0.2.0"
37
+ },
38
+ "optionalDependencies": {
39
+ "@napi-rs/keyring": "^1.2.0"
40
+ },
41
+ "exports": {
42
+ "./auth": {
43
+ "types": "./dist/auth.d.ts",
44
+ "default": "./dist/auth.js"
45
+ },
46
+ "./store": {
47
+ "types": "./dist/store.d.ts",
48
+ "default": "./dist/store.js"
49
+ }
50
+ },
51
+ "scripts": {
52
+ "build": "tsc -p tsconfig.json"
53
+ }
54
+ }