@onesi/genesis-cli 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.
- package/README.md +29 -2
- package/dist/beacons.js +68 -0
- package/dist/dials.js +7 -4
- package/dist/fleets.js +30 -0
- package/dist/flocks.d.ts +7 -1
- package/dist/flocks.js +257 -3
- package/dist/henry.d.ts +5 -1
- package/dist/henry.js +60 -1
- package/dist/hives-coverage.d.ts +12 -0
- package/dist/hives-coverage.js +116 -0
- package/dist/hives-node-transport.js +3 -0
- package/dist/hives-operations.d.ts +1 -0
- package/dist/hives-operations.js +2 -0
- package/dist/hives-platform.d.ts +13 -0
- package/dist/hives-platform.js +133 -0
- package/dist/iam-directory.d.ts +15 -0
- package/dist/iam-directory.js +71 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +255 -23
- package/dist/minds.d.ts +1 -1
- package/dist/minds.js +37 -2
- package/dist/onboard/art.d.ts +50 -0
- package/dist/onboard/art.js +139 -0
- package/dist/onboard/brand.d.ts +56 -0
- package/dist/onboard/brand.js +134 -0
- package/dist/onboard/caps.d.ts +90 -0
- package/dist/onboard/caps.js +232 -0
- package/dist/onboard/encode.d.ts +23 -0
- package/dist/onboard/encode.js +235 -0
- package/dist/onboard/eye.d.ts +103 -0
- package/dist/onboard/eye.js +147 -0
- package/dist/onboard/index.d.ts +61 -0
- package/dist/onboard/index.js +562 -0
- package/dist/onboard/mcp.d.ts +35 -0
- package/dist/onboard/mcp.js +118 -0
- package/dist/onboard/raster.d.ts +43 -0
- package/dist/onboard/raster.js +253 -0
- package/dist/onboard/sound.d.ts +2 -0
- package/dist/onboard/sound.js +54 -0
- package/dist/onboard/state.d.ts +24 -0
- package/dist/onboard/state.js +48 -0
- package/dist/onboard/term.d.ts +69 -0
- package/dist/onboard/term.js +292 -0
- package/dist/onboard/ui.d.ts +97 -0
- package/dist/onboard/ui.js +615 -0
- package/dist/orgs.d.ts +16 -0
- package/dist/orgs.js +89 -0
- package/dist/products.d.ts +6 -2
- package/dist/products.js +238 -12
- package/dist/relays-commands/certificates.d.ts +3 -0
- package/dist/relays-commands/certificates.js +20 -0
- package/dist/relays-commands/domains.d.ts +3 -0
- package/dist/relays-commands/domains.js +23 -0
- package/dist/relays-commands/index.d.ts +4 -0
- package/dist/relays-commands/index.js +10 -0
- package/dist/relays-commands/monitoring.d.ts +3 -0
- package/dist/relays-commands/monitoring.js +41 -0
- package/dist/relays-commands/telemetry.d.ts +3 -0
- package/dist/relays-commands/telemetry.js +28 -0
- package/dist/relays-commands/zones.d.ts +5 -0
- package/dist/relays-commands/zones.js +9 -0
- package/dist/runner.js +2 -0
- package/package.json +2 -2
package/dist/orgs.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { basename, extname } from 'node:path';
|
|
3
|
+
import { readFunctionFile, readFunctionJson, writeFunctionOutput } from './function-input.js';
|
|
4
|
+
/** Orgs accepts documents of 1 byte to 5 MiB (sent as base64 in JSON). */
|
|
5
|
+
export const ORGS_MAX_DOCUMENT_BYTES = 5 * 1024 * 1024;
|
|
6
|
+
const MEDIA_TYPES = {
|
|
7
|
+
'.pdf': 'application/pdf', '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg',
|
|
8
|
+
'.txt': 'text/plain', '.md': 'text/markdown', '.markdown': 'text/markdown', '.json': 'application/json',
|
|
9
|
+
};
|
|
10
|
+
const DOCUMENT_KINDS = ['articles', 'certificate', 'operating_agreement', 'bylaws', 'resolution', 'filing_receipt', 'tax_letter', 'other'];
|
|
11
|
+
const group = (parent, name) => parent.commands.find(c => c.name() === name) ?? parent.command(name);
|
|
12
|
+
/**
|
|
13
|
+
* The Orgs commands that are more than one JSON request: uploading a document from a file, downloading
|
|
14
|
+
* a document's bytes to a path (checked against its sha256), and requesting formation with --dry-run.
|
|
15
|
+
* Every other Orgs operation is a generic command under `genesis orgs` (products.ts).
|
|
16
|
+
*/
|
|
17
|
+
export function registerOrgs(program, deps) {
|
|
18
|
+
const orgs = group(program, 'orgs');
|
|
19
|
+
const documents = group(orgs, 'documents');
|
|
20
|
+
documents.command('add <entity>')
|
|
21
|
+
.description('Add a document from a file (up to 5 MiB) or a Boxes file (POST /v1/orgs/entities/{entity}/documents)')
|
|
22
|
+
.requiredOption('--kind <kind>', DOCUMENT_KINDS.join(' | '))
|
|
23
|
+
.option('--file <path>', 'document file; sent as base64')
|
|
24
|
+
.option('--boxes-file-id <id>', 'a Boxes file instead of --file')
|
|
25
|
+
.option('--title <title>', 'defaults to the file name')
|
|
26
|
+
.option('--media-type <type>', 'application/pdf | image/png | image/jpeg | text/plain | text/markdown | application/json (default: from the file extension)')
|
|
27
|
+
.action(async (entity, o) => {
|
|
28
|
+
if (!DOCUMENT_KINDS.includes(o.kind))
|
|
29
|
+
throw new Error(`--kind must be one of ${DOCUMENT_KINDS.join(', ')}`);
|
|
30
|
+
if (!o.file === !o.boxesFileId)
|
|
31
|
+
throw new Error('Pass exactly one of --file or --boxes-file-id.');
|
|
32
|
+
const mediaType = o.mediaType ?? (o.file ? MEDIA_TYPES[extname(o.file).toLowerCase()] : undefined);
|
|
33
|
+
if (!mediaType)
|
|
34
|
+
throw new Error('Pass --media-type (the file extension does not name a supported type).');
|
|
35
|
+
const title = o.title ?? (o.file ? basename(o.file) : undefined);
|
|
36
|
+
if (!title)
|
|
37
|
+
throw new Error('Pass --title.');
|
|
38
|
+
let content;
|
|
39
|
+
if (o.file) {
|
|
40
|
+
const bytes = await readFunctionFile(o.file, ORGS_MAX_DOCUMENT_BYTES);
|
|
41
|
+
if (!bytes.length)
|
|
42
|
+
throw new Error('The document file is empty.');
|
|
43
|
+
content = { content_base64: Buffer.from(bytes).toString('base64') };
|
|
44
|
+
}
|
|
45
|
+
else
|
|
46
|
+
content = { boxes_file_id: o.boxesFileId };
|
|
47
|
+
const body = { kind: o.kind, title, media_type: mediaType, ...content };
|
|
48
|
+
const result = await (await deps.client()).request('orgs_add_document', { entity, body }, { signal: deps.signal });
|
|
49
|
+
deps.emit(result, () => JSON.stringify(result, null, 2));
|
|
50
|
+
});
|
|
51
|
+
documents.command('content <document>')
|
|
52
|
+
.description("Download a document's bytes to a new file and check its sha256 (GET /v1/orgs/documents/{document}/content)")
|
|
53
|
+
.requiredOption('--out <path>', 'new file to write (an existing file is never overwritten)')
|
|
54
|
+
.action(async (document, o) => {
|
|
55
|
+
const genesis = await deps.client();
|
|
56
|
+
const { bytes, contentType, sha256 } = await genesis.orgs.documents.content(document, { signal: deps.signal });
|
|
57
|
+
const actual = createHash('sha256').update(bytes).digest('hex');
|
|
58
|
+
if (sha256 && sha256 !== actual)
|
|
59
|
+
throw new Error('The downloaded bytes do not match the document sha256. Nothing was written.');
|
|
60
|
+
await writeFunctionOutput(o.out, bytes);
|
|
61
|
+
const result = { document, path: o.out, bytes: bytes.byteLength, content_type: contentType, sha256: actual, verified: sha256 === actual };
|
|
62
|
+
deps.emit(result, () => JSON.stringify(result, null, 2));
|
|
63
|
+
});
|
|
64
|
+
group(orgs, 'formation').command('request <entity>')
|
|
65
|
+
.description('Prepare the formation packet and start a rehearsal run that stops at the state submit/payment page; --dry-run returns only the packet (POST /v1/orgs/entities/{entity}/formation)')
|
|
66
|
+
.option('--contact-email <email>', 'contact email for the filing (required unless in --body-file)')
|
|
67
|
+
.option('--runtime <runtime>', 'panes (default) | rigs | shells')
|
|
68
|
+
.option('--instance-id <id>', 'an existing browser instance to drive')
|
|
69
|
+
.option('--effective-date <date>', 'YYYY-MM-DD')
|
|
70
|
+
.option('--dry-run', 'build and return the packet only; start nothing')
|
|
71
|
+
.option('--body-file <path>', 'JSON request body (e.g. organizers), up to 1 MiB; flags override its fields')
|
|
72
|
+
.action(async (entity, o) => {
|
|
73
|
+
const body = o.bodyFile ? await readFunctionJson(o.bodyFile, 1024 * 1024) : {};
|
|
74
|
+
if (o.contactEmail !== undefined)
|
|
75
|
+
body.contact_email = o.contactEmail;
|
|
76
|
+
if (o.runtime !== undefined)
|
|
77
|
+
body.runtime = o.runtime;
|
|
78
|
+
if (o.instanceId !== undefined)
|
|
79
|
+
body.instance_id = o.instanceId;
|
|
80
|
+
if (o.effectiveDate !== undefined)
|
|
81
|
+
body.effective_date = o.effectiveDate;
|
|
82
|
+
if (o.dryRun)
|
|
83
|
+
body.dry_run = true;
|
|
84
|
+
if (typeof body.contact_email !== 'string')
|
|
85
|
+
throw new Error('Pass --contact-email (or contact_email in --body-file).');
|
|
86
|
+
const result = await (await deps.client()).request('orgs_request_formation', { entity, body }, { signal: deps.signal });
|
|
87
|
+
deps.emit(result, () => JSON.stringify(result, null, 2));
|
|
88
|
+
});
|
|
89
|
+
}
|
package/dist/products.d.ts
CHANGED
|
@@ -7,8 +7,12 @@ export declare const PRODUCT_COMMANDS: Record<string, {
|
|
|
7
7
|
description: string;
|
|
8
8
|
commands: Record<string, OperationId>;
|
|
9
9
|
}>;
|
|
10
|
-
|
|
10
|
+
type ProductDependencies = {
|
|
11
11
|
client: () => Promise<Genesis>;
|
|
12
12
|
emit: (data: unknown, pretty: () => string) => void;
|
|
13
13
|
signal?: AbortSignal;
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
|
+
export declare function registerProducts(program: Command, dependencies: ProductDependencies): void;
|
|
16
|
+
export declare function printableMediaType(contentType: string | null | undefined): boolean;
|
|
17
|
+
export declare function registerOperationCommands(root: Command, commands: Readonly<Record<string, OperationId>>, dependencies: ProductDependencies): void;
|
|
18
|
+
export {};
|
package/dist/products.js
CHANGED
|
@@ -1,16 +1,52 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { writeFile } from 'node:fs/promises';
|
|
2
|
+
import { idempotencyHeaders, ifMatchHeaders, mindsEngineCommands, operationTable } from '@onesi/genesis';
|
|
2
3
|
import { readFunctionJson } from './function-input.js';
|
|
3
4
|
/** Command words -> operation. Positional arguments are the operation's path parameters, query
|
|
4
5
|
* parameters become options, a body comes from --body-file, and --idempotency-key carries the
|
|
5
6
|
* Idempotency-Key header (required where the service requires it). */
|
|
6
7
|
export const PRODUCT_COMMANDS = {
|
|
7
|
-
rigs: { description: 'Rigs: your desktops (
|
|
8
|
-
panes: { description: 'Panes: your browsers (
|
|
9
|
-
shells: { description: 'Shells: your sandboxes (
|
|
10
|
-
|
|
8
|
+
rigs: { description: 'Rigs: your desktops (One account login or org API key with a selected project)', commands: { list: 'rigs_listRigs', get: 'rigs_getRig', create: 'rigs_createRig', delete: 'rigs_deleteRig', action: 'rigs_actOnRig', term: 'rigs_openRigTerm' } },
|
|
9
|
+
panes: { description: 'Panes: your browsers (One account login or org API key with a selected project)', commands: { list: 'panes_listPanes', get: 'panes_getPane', create: 'panes_createPane', delete: 'panes_deletePane', action: 'panes_actOnPane', term: 'panes_openPaneTerm', screenshot: 'panes_getPaneScreenshotData' } },
|
|
10
|
+
shells: { description: 'Shells: your sandboxes (One account login or org API key with a selected project)', commands: { list: 'shells_listShells', get: 'shells_getShell', create: 'shells_createShell', delete: 'shells_deleteShell', action: 'shells_actOnShell', term: 'shells_openShellTerm', exec: 'shells_execShell' } },
|
|
11
|
+
gateway: { description: 'Genesis gateway: status, the verified caller, usage, the error catalog and the served OpenAPI document (answered by the gateway itself)', commands: {
|
|
12
|
+
status: 'gateway_getStatus', whoami: 'gateway_whoami', usage: 'gateway_getUsage', errors: 'gateway_listErrors', openapi: 'gateway_getOpenApi',
|
|
13
|
+
} },
|
|
14
|
+
auth: { description: "Auth's public discovery documents, unchanged (no login needed; issuer stays https://auth.life.one)", commands: {
|
|
15
|
+
discovery: 'gateway_getAuthOpenIdConfiguration', jwks: 'gateway_getAuthJwks', lifeid: 'gateway_getAuthLifeId',
|
|
16
|
+
} },
|
|
17
|
+
orgs: { description: 'Your organization usage and billing reads, and Orgs: legal entities, seats, resolutions, documents, filings, formation rehearsals and the record', commands: {
|
|
18
|
+
usage: 'gateway_getOrgUsage', observations: 'gateway_getOrgUsageObservations', billing: 'gateway_getOrgBilling',
|
|
19
|
+
'payment-methods': 'gateway_listOrgPaymentMethods', service: 'gateway_getOrgServiceBilling',
|
|
20
|
+
// Orgs (legal entities). `documents add` (--file upload), `documents content` (download to a path) and
|
|
21
|
+
// `formation request` (--dry-run) are hand-written in orgs.ts.
|
|
22
|
+
whoami: 'orgs_whoami', portals: 'orgs_list_portals',
|
|
23
|
+
'entities list': 'orgs_list_entities', 'entities get': 'orgs_get_entity', 'entities create': 'orgs_create_entity',
|
|
24
|
+
'entities update': 'orgs_update_entity', 'entities archive': 'orgs_archive_entity',
|
|
25
|
+
'registered-agent set': 'orgs_set_registered_agent', 'registered-agent remove': 'orgs_remove_registered_agent',
|
|
26
|
+
'seats list': 'orgs_list_seats', 'seats create': 'orgs_create_seat', 'seats get': 'orgs_get_seat', 'seats update': 'orgs_update_seat', 'seats end': 'orgs_end_seat',
|
|
27
|
+
'resolutions list': 'orgs_list_resolutions', 'resolutions create': 'orgs_create_resolution', 'resolutions get': 'orgs_get_resolution', 'resolutions vote': 'orgs_vote',
|
|
28
|
+
'documents list': 'orgs_list_documents', 'documents get': 'orgs_get_document', 'documents sign': 'orgs_sign_document',
|
|
29
|
+
'filings list': 'orgs_list_filings', 'filings create': 'orgs_create_filing', 'filings get': 'orgs_get_filing', 'filings update': 'orgs_update_filing',
|
|
30
|
+
'formation-jobs list': 'orgs_list_formation_jobs', 'formation-jobs get': 'orgs_get_formation_job',
|
|
31
|
+
'formation-jobs steps': 'orgs_list_formation_steps', 'formation-jobs cancel': 'orgs_cancel_formation_job',
|
|
32
|
+
'record list': 'orgs_get_record', 'record verify': 'orgs_verify_record',
|
|
33
|
+
} },
|
|
34
|
+
billing: { description: 'Your organization billing: account, contacts, tax IDs, quotas, Minds account, invoices, usage report and the service catalog (login session, or an org API key with genesis.billing.read / .manage / genesis.usage.read). Nothing here pays or charges.', commands: {
|
|
35
|
+
'account get': 'gateway_getBillingAccount', 'account update': 'gateway_updateBillingAccount', 'account activity': 'gateway_listBillingActivity',
|
|
36
|
+
'contacts list': 'gateway_listBillingContacts', 'contacts create': 'gateway_createBillingContact', 'contacts delete': 'gateway_deleteBillingContact',
|
|
37
|
+
'tax-ids list': 'gateway_listBillingTaxIds', 'tax-ids create': 'gateway_createBillingTaxId', 'tax-ids delete': 'gateway_deleteBillingTaxId',
|
|
38
|
+
'quotas get': 'gateway_getOrgQuotas', 'quotas requests list': 'gateway_listQuotaRequests', 'quotas requests create': 'gateway_createQuotaRequest',
|
|
39
|
+
'minds-account': 'gateway_getMindsAccount', invoices: 'gateway_listOrgInvoices', 'usage-report': 'gateway_getOrgUsageReport', catalog: 'gateway_listBillingServices',
|
|
40
|
+
} },
|
|
41
|
+
gears: { description: 'Gears: durable workflows, runs, signals and run lifecycle', commands: {
|
|
11
42
|
'workflows list': 'gears_listWorkflows', 'workflows get': 'gears_getWorkflow', 'workflows register': 'gears_registerWorkflow',
|
|
12
43
|
'runs list': 'gears_listRuns', 'runs get': 'gears_getRun', 'runs history': 'gears_getRunHistory',
|
|
13
|
-
'runs start': 'gears_startRun', 'runs signal': 'gears_signalRun',
|
|
44
|
+
'runs start': 'gears_startRun', 'runs signal': 'gears_signalRun',
|
|
45
|
+
'runs cancel': 'gears_cancelRun', 'runs resume': 'gears_resumeRun', 'runs complete': 'gears_completeRun', 'runs fail': 'gears_failRun',
|
|
46
|
+
'runs timers start': 'gears_startTimer', 'runs retries schedule': 'gears_scheduleRetry', 'runs retries execute': 'gears_executeRetry',
|
|
47
|
+
'runs step-refs record': 'gears_recordStepRefs', 'runs children start': 'gears_startChildRun',
|
|
48
|
+
'runs compensations register': 'gears_registerCompensation', 'runs compensations rollback': 'gears_rollbackCompensations',
|
|
49
|
+
runtime: 'gears_getRuntime', records: 'gears_listOperationalRecords',
|
|
14
50
|
} },
|
|
15
51
|
lanes: { description: 'Lanes: agent context, cache, ledger and routing (Sandbox; One account login)', commands: {
|
|
16
52
|
'records get': 'lanes_getRecord', 'records write': 'lanes_writeRecord', 'records snapshot': 'lanes_snapshotRecords', 'records restore': 'lanes_restoreRecords',
|
|
@@ -22,6 +58,65 @@ export const PRODUCT_COMMANDS = {
|
|
|
22
58
|
'promotions list': 'lanes_listPromotionCandidates', 'promotions propose': 'lanes_proposePromotion', 'promotions review': 'lanes_reviewPromotion',
|
|
23
59
|
'operations records': 'lanes_listOperationalRecords', 'operations get': 'lanes_getOperation',
|
|
24
60
|
} },
|
|
61
|
+
auto: { description: "Auto: your organization's operating structure: orgs, mandates, positions, authority checks, budgets, policies, cadences, continuity and credentials", commands: {
|
|
62
|
+
whoami: 'auto_whoami',
|
|
63
|
+
'orgs list': 'auto_listOrgs', 'orgs get': 'auto_getOrg', 'orgs create': 'auto_createOrg', 'orgs update': 'auto_updateOrg', 'orgs archive': 'auto_archiveOrg',
|
|
64
|
+
'mandates list': 'auto_listMandates', 'mandates get': 'auto_getMandate', 'mandates create': 'auto_createMandate',
|
|
65
|
+
'mandates update': 'auto_updateMandate', 'mandates archive': 'auto_archiveMandate', 'mandates propose': 'auto_proposeAction',
|
|
66
|
+
'decisions record': 'auto_recordDecision', 'ledger list': 'auto_getLedger', 'ledger verify': 'auto_verifyLedger',
|
|
67
|
+
'approvals list': 'auto_listApprovals', 'approvals get': 'auto_getApproval', 'approvals decide': 'auto_decideApproval',
|
|
68
|
+
'units list': 'auto_listUnits', 'units get': 'auto_getUnit', 'units create': 'auto_createUnit', 'units update': 'auto_updateUnit', 'units archive': 'auto_archiveUnit',
|
|
69
|
+
'positions list': 'auto_listPositions', 'positions get': 'auto_getPosition', 'positions create': 'auto_createPosition',
|
|
70
|
+
'positions update': 'auto_updatePosition', 'positions archive': 'auto_archivePosition',
|
|
71
|
+
'positions appoint': 'auto_appointOccupant', 'positions vacate': 'auto_vacatePosition',
|
|
72
|
+
'positions terms': 'auto_listPositionTerms', 'positions scorecard': 'auto_getPositionScorecard',
|
|
73
|
+
'positions succession': 'auto_setPositionSuccession', 'positions acting start': 'auto_startActing', 'positions acting end': 'auto_endActing',
|
|
74
|
+
chart: 'auto_getOrgChart', continuity: 'auto_getOrgContinuity',
|
|
75
|
+
'authority check': 'auto_checkAuthority', 'authority get': 'auto_getAuthorityCheck', 'authority release': 'auto_releaseAuthorityCheck',
|
|
76
|
+
'authority verify': 'auto_verifyAuthorityToken',
|
|
77
|
+
'credentials issue': 'auto_issuePositionCredential', 'credentials list': 'auto_listCredentials', 'credentials get': 'auto_getCredential',
|
|
78
|
+
'credentials revoke': 'auto_revokeCredential', 'credentials status': 'auto_getCredentialStatus',
|
|
79
|
+
'keys jwks': 'auto_getJwks', 'keys did': 'auto_getDidDocument',
|
|
80
|
+
'budgets list': 'auto_listBudgets', 'budgets get': 'auto_getBudget', 'budgets create': 'auto_createBudget', 'budgets update': 'auto_updateBudget',
|
|
81
|
+
'budgets archive': 'auto_archiveBudget',
|
|
82
|
+
'policies list': 'auto_listPolicies', 'policies get': 'auto_getPolicy', 'policies create': 'auto_createPolicy', 'policies update': 'auto_updatePolicy',
|
|
83
|
+
'policies archive': 'auto_archivePolicy',
|
|
84
|
+
'cadences list': 'auto_listCadences', 'cadences due': 'auto_listDueCadences', 'cadences get': 'auto_getCadence', 'cadences create': 'auto_createCadence',
|
|
85
|
+
'cadences update': 'auto_updateCadence', 'cadences archive': 'auto_archiveCadence',
|
|
86
|
+
'cadences occurrences': 'auto_listCadenceOccurrences', 'cadences record': 'auto_recordCadenceOccurrence',
|
|
87
|
+
'goals list': 'auto_listGoals', 'goals get': 'auto_getGoal', 'goals create': 'auto_createGoal', 'goals update': 'auto_updateGoal',
|
|
88
|
+
'goals archive': 'auto_archiveGoal', 'goals measure': 'auto_recordGoalMeasurement', scorecard: 'auto_getOrgScorecard',
|
|
89
|
+
} },
|
|
90
|
+
scopes: { description: 'Scopes: the work graph (projects, tasks, dependencies, assignments to agents or people); agents run on Henry, Fleets or Flocks', commands: {
|
|
91
|
+
whoami: 'scopes_whoami', workload: 'scopes_getWorkload',
|
|
92
|
+
'projects list': 'scopes_listProjects', 'projects get': 'scopes_getProject', 'projects create': 'scopes_createProject',
|
|
93
|
+
'projects update': 'scopes_updateProject', 'projects archive': 'scopes_archiveProject', 'projects graph': 'scopes_getGraph',
|
|
94
|
+
'projects ready': 'scopes_listReady', 'projects tasks': 'scopes_listProjectTasks', 'projects activity': 'scopes_getProjectActivity',
|
|
95
|
+
'tasks list': 'scopes_listTasks', 'tasks get': 'scopes_getTask', 'tasks create': 'scopes_createTask', 'tasks update': 'scopes_updateTask',
|
|
96
|
+
'tasks archive': 'scopes_archiveTask', 'tasks assign': 'scopes_assignTask', 'tasks unassign': 'scopes_unassignTask',
|
|
97
|
+
'tasks assignments': 'scopes_listAssignments', 'tasks activity': 'scopes_getTaskActivity',
|
|
98
|
+
'dependencies list': 'scopes_listDependencies', 'dependencies add': 'scopes_addDependency', 'dependencies remove': 'scopes_removeDependency',
|
|
99
|
+
'comments list': 'scopes_listComments', 'comments add': 'scopes_addComment',
|
|
100
|
+
} },
|
|
101
|
+
garden: { description: 'Garden: your organization\'s own finance (books, accounts, journal, customers and vendors, invoices, payments, payouts, reports, audit trail; garden:read / garden:write / garden:manage)', commands: {
|
|
102
|
+
whoami: 'garden_whoami',
|
|
103
|
+
'books list': 'garden_listBooks', 'books get': 'garden_getBooks', 'books create': 'garden_createBooks', 'books update': 'garden_updateBooks', 'books archive': 'garden_archiveBooks',
|
|
104
|
+
'accounts list': 'garden_listAccounts', 'accounts get': 'garden_getAccount', 'accounts create': 'garden_createAccount', 'accounts update': 'garden_updateAccount',
|
|
105
|
+
'journal list': 'garden_listJournalEntries', 'journal get': 'garden_getJournalEntry', 'journal create': 'garden_createJournalEntry', 'journal update': 'garden_updateJournalEntry',
|
|
106
|
+
'journal discard': 'garden_discardJournalEntry', 'journal post': 'garden_postJournalEntry', 'journal reverse': 'garden_reverseJournalEntry',
|
|
107
|
+
'counterparties list': 'garden_listCounterparties', 'counterparties get': 'garden_getCounterparty', 'counterparties create': 'garden_createCounterparty', 'counterparties update': 'garden_updateCounterparty',
|
|
108
|
+
'invoices list': 'garden_listInvoices', 'invoices get': 'garden_getInvoice', 'invoices create': 'garden_createInvoice', 'invoices update': 'garden_updateInvoice',
|
|
109
|
+
'invoices finalize': 'garden_finalizeInvoice', 'invoices void': 'garden_voidInvoice', 'invoices uncollectible': 'garden_markInvoiceUncollectible', 'invoices pay': 'garden_recordInvoicePayment',
|
|
110
|
+
'payments list': 'garden_listPayments', 'payments get': 'garden_getPayment', 'payments create': 'garden_createPayment', 'payments authorize': 'garden_authorizePayment', 'payments cancel': 'garden_cancelPayment',
|
|
111
|
+
'payouts list': 'garden_listPayouts', 'payouts get': 'garden_getPayout', 'payouts create': 'garden_createPayout', 'payouts authorize': 'garden_authorizePayout', 'payouts cancel': 'garden_cancelPayout',
|
|
112
|
+
'reports trial-balance': 'garden_getTrialBalance', 'reports balance-sheet': 'garden_getBalanceSheet', 'reports income-statement': 'garden_getIncomeStatement', 'reports ar-aging': 'garden_getArAging',
|
|
113
|
+
'events list': 'garden_listEvents', 'events verify': 'garden_verifyEvents',
|
|
114
|
+
} },
|
|
115
|
+
zaps: { description: 'Zaps: key-value stores for agents and apps (org API key with zaps:read / zaps:write; Sandbox)', commands: {
|
|
116
|
+
list: 'zaps_listZaps', get: 'zaps_getZap', create: 'zaps_createZap', delete: 'zaps_deleteZap', purposes: 'zaps_listZapPurposes',
|
|
117
|
+
command: 'zaps_zapCommand', 'kv command': 'zaps_command', 'kv pipeline': 'zaps_pipeline', stats: 'zaps_getStats', metrics: 'zaps_getMetrics',
|
|
118
|
+
'audit search': 'zaps_searchAudit', 'audit stats': 'zaps_getAuditStats',
|
|
119
|
+
} },
|
|
25
120
|
flares: { description: 'Flares: agent notifications, conversations, commitments, presence, trust and choreography (Sandbox; One account login)', commands: {
|
|
26
121
|
list: 'flares_listFlares', get: 'flares_getFlare', send: 'flares_sendFlare', 'send-batch': 'flares_sendFlareBatch',
|
|
27
122
|
acknowledge: 'flares_acknowledgeFlare', act: 'flares_actOnFlare',
|
|
@@ -30,6 +125,7 @@ export const PRODUCT_COMMANDS = {
|
|
|
30
125
|
'commitments list': 'flares_listCommitments', 'commitments get': 'flares_getCommitment', 'commitments create': 'flares_createCommitment',
|
|
31
126
|
'commitments accept': 'flares_acceptCommitment', 'commitments start': 'flares_startCommitment', 'commitments progress': 'flares_reportCommitmentProgress',
|
|
32
127
|
'commitments fulfill': 'flares_fulfillCommitment', 'commitments fail': 'flares_failCommitment',
|
|
128
|
+
'presence list': 'flares_listPresence', 'trust list': 'flares_listTrust', 'activity list': 'flares_listActivity',
|
|
33
129
|
'presence heartbeat': 'flares_presenceHeartbeat', 'presence get': 'flares_getPresence',
|
|
34
130
|
'trust score': 'flares_getTrustScore', 'trust check': 'flares_checkTrust', 'trust endorsements': 'flares_listEndorsements',
|
|
35
131
|
'trust endorse': 'flares_createEndorsement', 'trust revoke': 'flares_revokeEndorsement',
|
|
@@ -39,6 +135,89 @@ export const PRODUCT_COMMANDS = {
|
|
|
39
135
|
'choreography executions complete-step': 'flares_completeChoreographyStep', 'choreography executions fail-step': 'flares_failChoreographyStep',
|
|
40
136
|
'choreography executions cancel': 'flares_cancelChoreographyExecution',
|
|
41
137
|
} },
|
|
138
|
+
// `traces runs create|list|get`, `traces search` and `traces usage` are hand-written in index.ts and keep working;
|
|
139
|
+
// every other admitted Traces route is listed here.
|
|
140
|
+
traces: { description: 'Traces: research and evidence (runs, sources, monitors, crawl, extract, verify)', commands: {
|
|
141
|
+
'runs steps': 'traces_getRunSteps', 'runs stream': 'traces_streamRun', 'runs evidence': 'traces_getRunEvidence',
|
|
142
|
+
'runs cancel': 'traces_cancelRun', 'runs pause': 'traces_pauseRun', 'runs resume': 'traces_resumeRun', 'runs retry': 'traces_retryRun',
|
|
143
|
+
'sources create': 'traces_createSource', 'sources list': 'traces_listSources', 'sources get': 'traces_getSource', 'sources update': 'traces_updateSource',
|
|
144
|
+
'sources delete': 'traces_deleteSource', 'sources check': 'traces_checkSource', 'sources health': 'traces_getSourceHealth',
|
|
145
|
+
'monitors create': 'traces_createMonitor', 'monitors list': 'traces_listMonitors', 'monitors get': 'traces_getMonitor', 'monitors update': 'traces_updateMonitor',
|
|
146
|
+
'monitors delete': 'traces_deleteMonitor', 'monitors check': 'traces_checkMonitor', 'monitors alerts': 'traces_listMonitorAlerts',
|
|
147
|
+
'monitors acknowledge-alert': 'traces_acknowledgeMonitorAlert',
|
|
148
|
+
'crawl create': 'traces_createCrawl', 'crawl get': 'traces_getCrawl', 'crawl cancel': 'traces_cancelCrawl',
|
|
149
|
+
'batch-scrape create': 'traces_createBatchScrape', 'batch-scrape get': 'traces_getBatchScrape', 'batch-scrape cancel': 'traces_cancelBatchScrape',
|
|
150
|
+
extract: 'traces_extract', 'extract-structured': 'traces_extractStructured', scrape: 'traces_scrape', map: 'traces_map',
|
|
151
|
+
'evidence list': 'traces_listEvidence', 'evidence get': 'traces_getEvidence', 'artifacts get': 'traces_getArtifact',
|
|
152
|
+
'ingest create': 'traces_ingestEvidence', 'ingest status': 'traces_getIngestStatus', 'ingest evaluate': 'traces_evaluateIngestFallback',
|
|
153
|
+
verify: 'traces_verifyClaim', 'spans': 'traces_listSpans', 'verdicts list': 'traces_listVerdicts', 'verdicts get': 'traces_getVerdict',
|
|
154
|
+
'coding resolve': 'traces_resolveLibrary', 'coding docs': 'traces_getLibraryDocs',
|
|
155
|
+
'usage-summary': 'traces_getUsageSummary', health: 'traces_getHealth',
|
|
156
|
+
'api-keys create': 'traces_createApiKey', 'api-keys list': 'traces_listApiKeys', 'api-keys get': 'traces_getApiKey',
|
|
157
|
+
'api-keys rotate': 'traces_rotateApiKey', 'api-keys revoke': 'traces_revokeApiKey',
|
|
158
|
+
} },
|
|
159
|
+
// `foundry models`, `foundry chat` and `foundry billing …` are hand-written in index.ts and keep working.
|
|
160
|
+
foundry: { description: 'Foundry: models, inference, receipts, keys and the model registry (inference needs a login; the universal API, routing, tools and workloads need a Console login)', commands: {
|
|
161
|
+
messages: 'foundry_createMessage', responses: 'foundry_createResponse', embeddings: 'foundry_createEmbedding', rerank: 'foundry_createRerank',
|
|
162
|
+
'images create': 'foundry_createImage', 'images models': 'foundry_listImageModels', transcribe: 'foundry_createAudioTranscription',
|
|
163
|
+
'receipts get': 'foundry_getGenerationReceipt', 'receipts by-request': 'foundry_getGenerationReceiptByRequest', 'receipts verification-key': 'foundry_getReceiptVerificationKey',
|
|
164
|
+
'keys list': 'foundry_listApiKeys', 'keys create': 'foundry_createApiKey', 'keys delete': 'foundry_deleteApiKey', 'keys rotate': 'foundry_rotateApiKey', 'keys current': 'foundry_getCurrentApiKey',
|
|
165
|
+
'reporting request-logs': 'foundry_listRequestLogs', 'reporting provider-credentials': 'foundry_getProviderCredentialSummary',
|
|
166
|
+
'activity list': 'foundry_getActivity', 'activity export': 'foundry_exportActivity', 'analytics meta': 'foundry_getAnalyticsMeta', 'analytics query': 'foundry_queryAnalytics',
|
|
167
|
+
'batches create': 'foundry_createBatch', 'batches get': 'foundry_getBatch',
|
|
168
|
+
infer: 'foundry_createInference', 'infer-stream': 'foundry_streamInference', classify: 'foundry_classifyText', detect: 'foundry_detectObjects',
|
|
169
|
+
segment: 'foundry_segmentImage', embed: 'foundry_embedTexts', 'transcribe-audio': 'foundry_transcribeAudio', speak: 'foundry_synthesizeSpeech',
|
|
170
|
+
'generate-image': 'foundry_generateImage', predict: 'foundry_predictTabular', forecast: 'foundry_forecastSeries', recommend: 'foundry_recommendItems',
|
|
171
|
+
annotate: 'foundry_annotateText', summarize: 'foundry_summarizeText',
|
|
172
|
+
'routing preview': 'foundry_previewRoute', 'routing explain': 'foundry_explainRoutingInvocation',
|
|
173
|
+
'routing evals plan': 'foundry_planRoutingEval', 'routing evals dispatch-plan': 'foundry_dispatchRoutingEvalPlan',
|
|
174
|
+
'routing evals aggregate-dispatch': 'foundry_aggregateRoutingEvalDispatch', 'routing evals aggregate-planned': 'foundry_aggregatePlannedRoutingEval',
|
|
175
|
+
'routing evals aggregate': 'foundry_aggregateRoutingEval', 'routing evals claim-readiness': 'foundry_checkRoutingEvalClaimReadiness',
|
|
176
|
+
'tools cost-estimate': 'foundry_estimateCost', 'tools compare': 'foundry_compareModels', 'tools benchmark': 'foundry_benchmarkModels',
|
|
177
|
+
'workloads status': 'foundry_getWorkloadStatus', 'workloads terminate': 'foundry_terminateWorkload',
|
|
178
|
+
'generation get': 'foundry_getGeneration', 'generation content': 'foundry_getGenerationContent', 'generation feedback': 'foundry_submitGenerationFeedback',
|
|
179
|
+
'registry models': 'foundry_listRegistryModels', 'registry model': 'foundry_getRegistryModel', 'registry offers': 'foundry_listModelOffers',
|
|
180
|
+
'registry dossier': 'foundry_getModelDossier', 'registry benchmarks': 'foundry_listModelBenchmarks', 'registry sources': 'foundry_listModelSources',
|
|
181
|
+
'registry providers': 'foundry_listRegistryProviders', 'registry provider': 'foundry_getRegistryProvider', 'registry provider-dossier': 'foundry_getProviderDossier',
|
|
182
|
+
'registry facets': 'foundry_listRegistryFacets', 'registry model-base': 'foundry_getCurrentModelBase', 'registry model-base-releases': 'foundry_listModelBaseReleases',
|
|
183
|
+
'registry labs': 'foundry_listRegistryLabs', 'registry lab': 'foundry_getRegistryLab', 'registry compare': 'foundry_compareRegistryModels',
|
|
184
|
+
'registry v2 models': 'foundry_listRegistryModelsV2', 'registry v2 model': 'foundry_getRegistryModelV2', 'registry v2 dossier': 'foundry_getModelDossierV2',
|
|
185
|
+
'registry v2 providers': 'foundry_listRegistryProvidersV2', 'registry v2 provider': 'foundry_getProviderDossierV2', 'registry v2 facets': 'foundry_listRegistryFacetsV2',
|
|
186
|
+
'registry v2 model-base': 'foundry_getCurrentModelBaseV2', 'registry v2 model-base-releases': 'foundry_listModelBaseReleasesV2',
|
|
187
|
+
'registry v2 labs': 'foundry_listRegistryLabsV2', 'registry v2 lab': 'foundry_getRegistryLabV2', 'registry v2 compare': 'foundry_compareRegistryModelsV2',
|
|
188
|
+
'registry v2 benchmarks': 'foundry_listRegistryBenchmarksV2', 'registry v2 sources': 'foundry_listRegistrySourcesV2', 'registry v2 provenance': 'foundry_listRegistryProvenanceV2',
|
|
189
|
+
} },
|
|
190
|
+
// IAM v4 (projects and workspaces are `genesis projects` / `genesis workspaces`). `agents enroll` is hand-written in index.ts:
|
|
191
|
+
// it sends only an enrollment key. Inviting, member role changes and removal stay with a person in the Console.
|
|
192
|
+
iam: { description: 'IAM: organizations, fleets, agents, roles, grants, capabilities and permission checks (One account login, or an org API key with iam:read / iam:write)', commands: {
|
|
193
|
+
'orgs list': 'iam_listOrgs', 'orgs get': 'iam_getOrg', 'orgs update': 'iam_updateOrg', 'orgs members': 'iam_listMembers', 'orgs entitlements': 'iam_listEntitlements',
|
|
194
|
+
'fleets list': 'iam_listFleets', 'fleets get': 'iam_getFleet', 'fleets create': 'iam_createFleet', 'fleets update': 'iam_updateFleet', 'fleets delete': 'iam_deleteFleet',
|
|
195
|
+
'agents list': 'iam_listAgents', 'agents get': 'iam_getAgent', 'agents create': 'iam_createAgent', 'agents revoke': 'iam_deleteAgent',
|
|
196
|
+
'agents suspend': 'iam_suspendAgent', 'agents resume': 'iam_resumeAgent', 'agents rotate': 'iam_rotateAgentKey',
|
|
197
|
+
'agents acts list': 'iam_listAgentActs', 'agents acts issue': 'iam_issueAgentAct',
|
|
198
|
+
'agents publication': 'iam_getAgentPublication', 'agents orbit-msgs-grant': 'iam_getOrbitMsgsProductGrant', 'agents public': 'iam_getPublicAgent',
|
|
199
|
+
'agents for-mind': 'iam_listMindAgents', 'agents enrollment-grants': 'iam_listAgentEnrollmentGrants',
|
|
200
|
+
'roles list': 'iam_listRoles', 'roles get': 'iam_getRole', 'roles create': 'iam_createRole', 'roles update': 'iam_updateRole', 'roles delete': 'iam_deleteRole',
|
|
201
|
+
'grants list': 'iam_listGrants', 'grants get': 'iam_getGrant', 'grants create': 'iam_createGrant', 'grants update': 'iam_updateGrant', 'grants delete': 'iam_deleteGrant',
|
|
202
|
+
'capabilities get': 'iam_getCapability', 'capabilities create': 'iam_createCapability', 'capabilities update': 'iam_updateCapability',
|
|
203
|
+
'capabilities revoke': 'iam_deleteCapability', 'capabilities verify': 'iam_verifyCapability',
|
|
204
|
+
platforms: 'iam_listPlatforms', 'tenant-context': 'iam_getTenantContext',
|
|
205
|
+
'check-permission': 'iam_checkPermission', 'require-permission': 'iam_requirePermission', 'check-entitlement': 'iam_checkEntitlement',
|
|
206
|
+
} },
|
|
207
|
+
taps: { description: 'Taps: ask a human to decide; respond and lineage need a One account login (Sandbox)', commands: {
|
|
208
|
+
create: 'taps_createTap', list: 'taps_listTaps', get: 'taps_getTap', cancel: 'taps_cancelTap',
|
|
209
|
+
respond: 'taps_respondToTap', events: 'taps_listTapEvents',
|
|
210
|
+
'routing-rules list': 'taps_listRoutingRules', 'routing-rules create': 'taps_createRoutingRule',
|
|
211
|
+
'routing-rules update': 'taps_updateRoutingRule', 'routing-rules delete': 'taps_deleteRoutingRule',
|
|
212
|
+
'escalation-policies list': 'taps_listEscalationPolicies', 'escalation-policies create': 'taps_createEscalationPolicy',
|
|
213
|
+
'escalation-policies update': 'taps_updateEscalationPolicy', 'escalation-policies delete': 'taps_deleteEscalationPolicy',
|
|
214
|
+
'settings get': 'taps_getSettings', 'settings update': 'taps_updateSettings',
|
|
215
|
+
'garden get': 'taps_getGardenIntegration', 'garden enable': 'taps_enableGardenIntegration',
|
|
216
|
+
'lineage challenge': 'taps_createAgentLineageChallenge', 'lineage requests create': 'taps_createAgentLineageRequest',
|
|
217
|
+
'lineage requests list': 'taps_listAgentLineageRequests', 'lineage requests get': 'taps_getAgentLineageRequest',
|
|
218
|
+
} },
|
|
219
|
+
// `genesis minds engine <family> <verb> <mind_id> [params]`: every Minds engine route, generated from the grant table.
|
|
220
|
+
minds: { description: 'Minds: your Sandbox Minds (One account login)', commands: mindsEngineCommands },
|
|
42
221
|
};
|
|
43
222
|
const BODY_LIMIT = 1024 * 1024;
|
|
44
223
|
const flag = (name) => name.replace(/_/g, '-').replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
@@ -46,7 +225,20 @@ const flag = (name) => name.replace(/_/g, '-').replace(/([a-z])([A-Z])/g, '$1-$2
|
|
|
46
225
|
const key = (name) => flag(name).replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
47
226
|
export function registerProducts(program, dependencies) {
|
|
48
227
|
for (const [service, { description, commands }] of Object.entries(PRODUCT_COMMANDS)) {
|
|
49
|
-
|
|
228
|
+
// A service with hand-written commands (Traces) keeps them: this adds the rest beside them.
|
|
229
|
+
const root = program.commands.find(c => c.name() === service) ?? program.command(service).description(description);
|
|
230
|
+
registerOperationCommands(root, commands, dependencies);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/** One generic command per operation under `root` (Relays adds its family routes beside its hand-written commands). */
|
|
234
|
+
/** Media types a raw answer may print to stdout without --out: text, JSON, NDJSON and XML (structured suffixes included). Parameters are ignored; a missing type is not printable. */
|
|
235
|
+
const PRINTABLE_MEDIA_TYPE = /^(?:text\/[a-z0-9!#$&^_.+-]+|application\/(?:json|x-ndjson|xml)|application\/[a-z0-9!#$&^_.-]+\+(?:json|xml))$/;
|
|
236
|
+
export function printableMediaType(contentType) {
|
|
237
|
+
const media = contentType?.split(';')[0].trim().toLowerCase();
|
|
238
|
+
return !!media && PRINTABLE_MEDIA_TYPE.test(media);
|
|
239
|
+
}
|
|
240
|
+
export function registerOperationCommands(root, commands, dependencies) {
|
|
241
|
+
{
|
|
50
242
|
const groups = new Map();
|
|
51
243
|
for (const [words, id] of Object.entries(commands)) {
|
|
52
244
|
const op = operationTable[id];
|
|
@@ -55,19 +247,32 @@ export function registerProducts(program, dependencies) {
|
|
|
55
247
|
for (let i = 0; i < parts.length - 1; i++) {
|
|
56
248
|
const key = parts.slice(0, i + 1).join(' ');
|
|
57
249
|
if (!groups.has(key))
|
|
58
|
-
groups.set(key, parent.command(parts[i]));
|
|
250
|
+
groups.set(key, parent.commands.find(c => c.name() === parts[i]) ?? parent.command(parts[i]));
|
|
59
251
|
parent = groups.get(key);
|
|
60
252
|
}
|
|
61
253
|
const bodyRequired = op.inputSchema.required.includes('body');
|
|
62
254
|
const command = parent.command([parts.at(-1), ...op.pathParams.map(p => `<${p}>`)].join(' ')).description(`${op.summary} (${op.method} ${op.path})`);
|
|
63
|
-
|
|
64
|
-
|
|
255
|
+
const props = (op.inputSchema.properties ?? {});
|
|
256
|
+
// An array query parameter (Foundry registry compare `model`) is a repeatable flag, sent as `?q=a&q=b`.
|
|
257
|
+
for (const q of op.queryParams) {
|
|
258
|
+
if (props[q]?.type === 'array')
|
|
259
|
+
command.option(`--${flag(q)} <value>`, 'repeat for each value', (v, prev = []) => [...prev, v]);
|
|
260
|
+
else
|
|
261
|
+
command.option(`--${flag(q)} <value>`);
|
|
262
|
+
}
|
|
65
263
|
if (op.hasBody)
|
|
66
264
|
command[bodyRequired ? 'requiredOption' : 'option']('--body-file <path>', 'JSON request body, up to 1 MiB');
|
|
265
|
+
if (op.ifMatch)
|
|
266
|
+
command.requiredOption('--if-match <version>', 'The version you read (the version field of the object you are changing, or its ETag); a stale one is refused');
|
|
67
267
|
if (op.idempotencyKey === 'required')
|
|
68
268
|
command.requiredOption('--idempotency-key <key>', 'Stable key; reuse it to replay instead of acting twice');
|
|
69
269
|
else if (op.idempotencyKey)
|
|
70
|
-
command.option('--idempotency-key <key>',
|
|
270
|
+
command.option('--idempotency-key <key>', op.service === 'auto'
|
|
271
|
+
? 'Optional stable key, 8-128 characters of A-Z a-z 0-9 _ . : -; a repeat returns the first answer'
|
|
272
|
+
: 'Optional stable key; a retry with it returns the original result');
|
|
273
|
+
// A raw answer can be written to a file; a binary one (e.g. a Panes screenshot) must be.
|
|
274
|
+
if (op.rawResponse)
|
|
275
|
+
command.option('--out <path>', 'File to write the response bytes to (required for a binary answer)');
|
|
71
276
|
command.action(async (...args) => {
|
|
72
277
|
const options = args[op.pathParams.length];
|
|
73
278
|
const input = Object.fromEntries(op.pathParams.map((p, i) => [p, args[i]]));
|
|
@@ -76,8 +281,29 @@ export function registerProducts(program, dependencies) {
|
|
|
76
281
|
input[q] = options[key(q)];
|
|
77
282
|
if (options.bodyFile)
|
|
78
283
|
input.body = await readFunctionJson(options.bodyFile, BODY_LIMIT);
|
|
79
|
-
const headers = idempotencyHeaders(id, options.idempotencyKey);
|
|
284
|
+
const headers = { ...idempotencyHeaders(id, options.idempotencyKey), ...(op.ifMatch ? ifMatchHeaders(id, options.ifMatch) : {}) };
|
|
80
285
|
const result = await (await dependencies.client()).request(id, input, { headers, signal: dependencies.signal });
|
|
286
|
+
if (result instanceof Response) {
|
|
287
|
+
// With --out, a raw answer (e.g. a Panes screenshot) is written to the file as bytes.
|
|
288
|
+
if (options.out) {
|
|
289
|
+
if (!result.ok) {
|
|
290
|
+
void result.body?.cancel().catch(() => { });
|
|
291
|
+
throw new Error(`${id} answered ${result.status}`);
|
|
292
|
+
}
|
|
293
|
+
const bytes = Buffer.from(await result.arrayBuffer());
|
|
294
|
+
await writeFile(options.out, bytes);
|
|
295
|
+
const written = { ok: true, path: options.out, bytes: bytes.length, contentType: result.headers.get('content-type') };
|
|
296
|
+
return dependencies.emit(written, () => JSON.stringify(written, null, 2));
|
|
297
|
+
}
|
|
298
|
+
// Without it, only a declared text answer (an SSE stream such as foundry infer-stream) prints; anything else needs --out.
|
|
299
|
+
const type = result.headers.get('content-type');
|
|
300
|
+
if (!printableMediaType(type)) {
|
|
301
|
+
void result.body?.cancel().catch(() => { });
|
|
302
|
+
throw new Error(`${id} answered ${type || 'no content type'}; pass --out <path> to save it`);
|
|
303
|
+
}
|
|
304
|
+
const text = await result.text();
|
|
305
|
+
return dependencies.emit(text, () => text);
|
|
306
|
+
}
|
|
81
307
|
dependencies.emit(result ?? { ok: true }, () => JSON.stringify(result ?? { ok: true }, null, 2));
|
|
82
308
|
});
|
|
83
309
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** `genesis relays ...` words for the certificates family (openapi/specs/relays/certificates.openapi.yaml). */
|
|
2
|
+
export const certificatesCommands = {
|
|
3
|
+
'certificates list': 'relays_listCertificates',
|
|
4
|
+
'certificates create': 'relays_createCertificate',
|
|
5
|
+
'certificates get': 'relays_getCertificate',
|
|
6
|
+
'certificates update': 'relays_updateCertificate',
|
|
7
|
+
'certificates delete': 'relays_deleteCertificate',
|
|
8
|
+
'certificates renew': 'relays_renewCertificate',
|
|
9
|
+
'certificates download': 'relays_downloadCertificate',
|
|
10
|
+
'certificates history': 'relays_listCertificateHistory',
|
|
11
|
+
'certificates events': 'relays_listCertificateEvents',
|
|
12
|
+
'certificates total-tls list': 'relays_listTotalTlsZones',
|
|
13
|
+
'certificates total-tls enable': 'relays_enableTotalTls',
|
|
14
|
+
'certificates total-tls disable': 'relays_disableTotalTls',
|
|
15
|
+
'certificates ct-monitors list': 'relays_listCtMonitors',
|
|
16
|
+
'certificates ct-monitors create': 'relays_createCtMonitor',
|
|
17
|
+
'certificates ct-monitors get': 'relays_getCtMonitor',
|
|
18
|
+
'certificates ct-monitors update': 'relays_updateCtMonitor',
|
|
19
|
+
'certificates ct-monitors delete': 'relays_deleteCtMonitor',
|
|
20
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** `genesis relays ...` words for the domains family (openapi/specs/relays/domains.openapi.yaml). */
|
|
2
|
+
export const domainsCommands = {
|
|
3
|
+
'registrar search': 'relays_searchRegistrarDomains',
|
|
4
|
+
'registrar domains list': 'relays_listRegistrarDomains',
|
|
5
|
+
'registrar domains get': 'relays_getRegistrarDomain',
|
|
6
|
+
'domains analyze': 'relays_analyzeDomain',
|
|
7
|
+
'domains suggest': 'relays_suggestDomains',
|
|
8
|
+
'forwarding list': 'relays_listDomainForwardingRules',
|
|
9
|
+
'forwarding create': 'relays_createDomainForwardingRule',
|
|
10
|
+
'forwarding delete': 'relays_deleteDomainForwardingRule',
|
|
11
|
+
'providers list': 'relays_listDnsProviders',
|
|
12
|
+
'providers plan': 'relays_planDnsProviderChanges',
|
|
13
|
+
'connections list': 'relays_listDnsProviderConnections',
|
|
14
|
+
'connections create': 'relays_createDnsProviderConnection',
|
|
15
|
+
'connections delete': 'relays_deleteDnsProviderConnection',
|
|
16
|
+
'connections sync': 'relays_syncDnsProviderConnection',
|
|
17
|
+
'connections validate': 'relays_validateProviderConnection',
|
|
18
|
+
'connections zones': 'relays_listDnsProviderZones',
|
|
19
|
+
'connections records': 'relays_listDnsProviderZoneRecords',
|
|
20
|
+
'connections apply': 'relays_applyDnsProviderZoneChanges',
|
|
21
|
+
'assets list': 'relays_listDomainAssets',
|
|
22
|
+
'assets get': 'relays_getDomainAsset',
|
|
23
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { OperationId } from '@onesi/genesis';
|
|
2
|
+
/** Generic `genesis relays ...` commands for the family routes, one file per family. The zone,
|
|
3
|
+
* record and enrollment commands are hand-written in index.ts and keep working. */
|
|
4
|
+
export declare const RELAYS_COMMANDS: Readonly<Record<string, OperationId>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { certificatesCommands } from './certificates.js';
|
|
2
|
+
import { domainsCommands } from './domains.js';
|
|
3
|
+
import { monitoringCommands } from './monitoring.js';
|
|
4
|
+
import { telemetryCommands } from './telemetry.js';
|
|
5
|
+
import { zonesCommands } from './zones.js';
|
|
6
|
+
/** Generic `genesis relays ...` commands for the family routes, one file per family. The zone,
|
|
7
|
+
* record and enrollment commands are hand-written in index.ts and keep working. */
|
|
8
|
+
export const RELAYS_COMMANDS = {
|
|
9
|
+
...certificatesCommands, ...monitoringCommands, ...telemetryCommands, ...domainsCommands, ...zonesCommands,
|
|
10
|
+
};
|
|
@@ -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,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>>;
|