@onesi/genesis-cli 0.2.6 → 0.2.7
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.
- package/README.md +1 -1
- package/dist/index.js +4 -4
- package/dist/products.js +31 -4
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ export function buildProgram(deps = {}) {
|
|
|
41
41
|
const auth = { ...authConfig(env, f), sleep: deps.sleep };
|
|
42
42
|
const program = new Command('genesis')
|
|
43
43
|
.description('One CLI for every Genesis service.')
|
|
44
|
-
.version('0.2.
|
|
44
|
+
.version('0.2.7')
|
|
45
45
|
.option('--json', 'machine-readable JSON output')
|
|
46
46
|
.option('--api-key <key>', 'use this API key (default: GENESIS_API_KEY, then your `genesis login`)')
|
|
47
47
|
.option('--base-url <url>', 'gateway URL (default: GENESIS_BASE_URL or https://os.one.ml/api)')
|
|
@@ -57,7 +57,7 @@ export function buildProgram(deps = {}) {
|
|
|
57
57
|
const opts = {
|
|
58
58
|
apiKey: o.apiKey ?? env.GENESIS_API_KEY, token: env.GENESIS_TOKEN,
|
|
59
59
|
baseUrl: o.baseUrl ?? env.GENESIS_BASE_URL, routing: o.direct || env.GENESIS_ROUTING === 'direct' ? 'direct' : 'gateway',
|
|
60
|
-
fetch: f, userAgent: 'genesis-cli/0.2.
|
|
60
|
+
fetch: f, userAgent: 'genesis-cli/0.2.7',
|
|
61
61
|
credentials: store ? savedLoginProvider(auth, store) : undefined,
|
|
62
62
|
};
|
|
63
63
|
return new Genesis(hivesTransport ? { ...opts, fetch: createHivesNodeTransport(opts, deps.signal) } : opts);
|
|
@@ -278,7 +278,7 @@ export function buildProgram(deps = {}) {
|
|
|
278
278
|
if (!key)
|
|
279
279
|
throw new Error('Give the enrollment key with --key-file, --key-stdin or GENESIS_ENROLLMENT_KEY; it is never accepted as an argument.');
|
|
280
280
|
const body = await readFunctionJson(o.bodyFile, 16 * 1024);
|
|
281
|
-
const result = await new Genesis({ baseUrl: g().baseUrl ?? env.GENESIS_BASE_URL, fetch: f, userAgent: 'genesis-cli/0.2.
|
|
281
|
+
const result = await new Genesis({ baseUrl: g().baseUrl ?? env.GENESIS_BASE_URL, fetch: f, userAgent: 'genesis-cli/0.2.7' }).iam.agents.enroll(key, body);
|
|
282
282
|
emit(result, () => JSON.stringify(result, null, 2));
|
|
283
283
|
});
|
|
284
284
|
// ---- auth ------------------------------------------------------------
|
|
@@ -813,7 +813,7 @@ export function buildProgram(deps = {}) {
|
|
|
813
813
|
const url = `${base.href.replace(/\/+$/, '')}/v1/status`;
|
|
814
814
|
let response;
|
|
815
815
|
try {
|
|
816
|
-
response = await f(url, { method: 'GET', headers: { accept: 'application/json', 'user-agent': 'genesis-cli/0.2.
|
|
816
|
+
response = await f(url, { method: 'GET', headers: { accept: 'application/json', 'user-agent': 'genesis-cli/0.2.7' }, signal: AbortSignal.timeout(15_000) });
|
|
817
817
|
}
|
|
818
818
|
catch (e) {
|
|
819
819
|
throw new Error(`Gateway unreachable at ${safe(url)}: ${safe(e.message)}`);
|
package/dist/products.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { idempotencyHeaders, ifMatchHeaders, mindsEngineCommands, operationTable } from '@onesi/genesis';
|
|
2
|
-
import { readFile, writeFile } from 'node:fs/promises';
|
|
1
|
+
import { MAX_FOUNDRY_FILE_BYTES, foundryFileMimeType, foundryFileUploadBody, isFoundryMediaType, idempotencyHeaders, ifMatchHeaders, mindsEngineCommands, operationTable } from '@onesi/genesis';
|
|
2
|
+
import { readFile, stat, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { basename } from 'node:path';
|
|
4
4
|
import { readFunctionJson } from './function-input.js';
|
|
5
5
|
/** Command words -> operation. Positional arguments are the operation's path parameters, query
|
|
@@ -60,7 +60,7 @@ export const PRODUCT_COMMANDS = {
|
|
|
60
60
|
'operations records': 'lanes_listOperationalRecords', 'operations get': 'lanes_getOperation',
|
|
61
61
|
} },
|
|
62
62
|
auto: { description: "Auto: your organization's operating structure: orgs, mandates, positions, authority checks, budgets, policies, cadences, continuity and credentials", commands: {
|
|
63
|
-
whoami: 'auto_whoami',
|
|
63
|
+
whoami: 'auto_whoami', mcp: 'auto_callMcp',
|
|
64
64
|
'orgs list': 'auto_listOrgs', 'orgs get': 'auto_getOrg', 'orgs create': 'auto_createOrg', 'orgs update': 'auto_updateOrg', 'orgs archive': 'auto_archiveOrg',
|
|
65
65
|
'mandates list': 'auto_listMandates', 'mandates get': 'auto_getMandate', 'mandates create': 'auto_createMandate',
|
|
66
66
|
'mandates update': 'auto_updateMandate', 'mandates archive': 'auto_archiveMandate', 'mandates propose': 'auto_proposeAction',
|
|
@@ -245,6 +245,15 @@ export const PRODUCT_COMMANDS = {
|
|
|
245
245
|
'mail domains list': 'boxes_mail_domains_list',
|
|
246
246
|
'mail domains verify': 'boxes_mail_domains_verify',
|
|
247
247
|
'mail inbox list': 'boxes_mail_inbox_list',
|
|
248
|
+
'mail agents list': 'boxes_mail_agents_list',
|
|
249
|
+
'mail agents create': 'boxes_mail_agents_create',
|
|
250
|
+
'mail agents get': 'boxes_mail_agents_get',
|
|
251
|
+
'mail agents delete': 'boxes_mail_agents_delete',
|
|
252
|
+
'mail agents inbox list': 'boxes_mail_agents_inbox_list',
|
|
253
|
+
'mail agents send': 'boxes_mail_agents_send',
|
|
254
|
+
'mail agents threads list': 'boxes_mail_agents_threads_list',
|
|
255
|
+
'mail agents threads get': 'boxes_mail_agents_threads_get',
|
|
256
|
+
'mail agents messages get': 'boxes_mail_agents_messages_get',
|
|
248
257
|
'mail mailboxes list': 'boxes_mail_mailboxes_list',
|
|
249
258
|
'mail messages get': 'boxes_mail_messages_get',
|
|
250
259
|
'mail messages delete': 'boxes_mail_messages_delete',
|
|
@@ -450,7 +459,14 @@ export function registerOperationCommands(root, commands, dependencies) {
|
|
|
450
459
|
const boxes = op.service === 'boxes';
|
|
451
460
|
const multipart = boxes && op.requestContentType === 'multipart/form-data';
|
|
452
461
|
const boxesRaw = boxes && !!op.rawResponse;
|
|
453
|
-
|
|
462
|
+
// Foundry file upload: one real file from disk (`--file <path>`) and an optional `--purpose`.
|
|
463
|
+
const foundryUpload = id === 'foundry_uploadFile';
|
|
464
|
+
if (foundryUpload) {
|
|
465
|
+
command.requiredOption('--file <path>', 'Local file to upload (1 byte to 8 MiB)');
|
|
466
|
+
command.option('--content-type <type>', 'Media type of the file (default: from the file extension; Foundry refuses application/octet-stream)');
|
|
467
|
+
command.option('--purpose <purpose>', 'What the file is for, e.g. fine-tune, batch or assistants');
|
|
468
|
+
}
|
|
469
|
+
else if (multipart) {
|
|
454
470
|
command.option('--file <part=path>', 'File part, repeatable: part name and local path', (v, all = []) => [...all, v]);
|
|
455
471
|
command.option('--field <part=value>', 'Text part, repeatable', (v, all = []) => [...all, v]);
|
|
456
472
|
}
|
|
@@ -481,6 +497,17 @@ export function registerOperationCommands(root, commands, dependencies) {
|
|
|
481
497
|
input.body = await readFunctionJson(options.bodyFile, BODY_LIMIT);
|
|
482
498
|
const headers = { ...idempotencyHeaders(id, options.idempotencyKey), ...(op.ifMatch ? ifMatchHeaders(id, options.ifMatch) : {}) };
|
|
483
499
|
const extra = options;
|
|
500
|
+
if (foundryUpload) {
|
|
501
|
+
const path = options.file;
|
|
502
|
+
if (options.contentType !== undefined && !isFoundryMediaType(options.contentType))
|
|
503
|
+
throw new Error('--content-type must look like type/subtype.');
|
|
504
|
+
const info = await stat(path).catch(() => { throw new Error(`Could not open ${path}.`); });
|
|
505
|
+
if (!info.isFile())
|
|
506
|
+
throw new Error(`${path} is not a regular file.`);
|
|
507
|
+
if (info.size > MAX_FOUNDRY_FILE_BYTES)
|
|
508
|
+
throw new Error('Choose a file of 1 byte to 8 MiB.');
|
|
509
|
+
input.body = foundryFileUploadBody(new Blob([new Uint8Array(await readFile(path))], { type: options.contentType ?? foundryFileMimeType(basename(path)) }), { filename: basename(path), purpose: options.purpose });
|
|
510
|
+
}
|
|
484
511
|
if (multipart) {
|
|
485
512
|
const form = new FormData();
|
|
486
513
|
const split = (entry) => { const at = entry.indexOf('='); if (at < 1)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onesi/genesis-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/l1felabs/genesis-api.git",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"commander": "^14.0.0",
|
|
35
35
|
"undici": "6.29.0",
|
|
36
|
-
"@onesi/genesis": "0.2.
|
|
36
|
+
"@onesi/genesis": "0.2.7"
|
|
37
37
|
},
|
|
38
38
|
"optionalDependencies": {
|
|
39
39
|
"@napi-rs/keyring": "^1.2.0"
|