@rine-network/cli 0.12.0 → 0.13.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/dist/main.js +36 -3
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { Command, Option } from "commander";
|
|
3
|
-
import { FUNNEL_TIERS, HttpClient, IdempotencyStore, RineApiError, UUID_RE, addMlsGroupMember, agentKeysExist, agentLabel, buildIssueCertDeps, cacheToken, connectTunnel, decryptGroupMessage, decryptMessage, decryptThreadRow, deleteHookSecret, encryptGroupMessage, encryptMessage, encryptMlsGroupMessage, ensureCert, externalJoinMlsGroup, fetchAgents, fetchAndIngestPendingSKDistributions, fetchOAuthToken, fetchRecipientKeys, formatError, fromBase64Url, generateAgentKeys, generateHookSecret, generatePqKeyPair, getAgentPublicKeys, getCredentialEntry, getOrCreateSenderKey, getOrRefreshToken, handleWebhookRequest, ingestSenderKeyDistribution, initMlsGroup, isBareAgentName, isValidHookName, listMyInvites, loadAgentKeys, loadCredentials, loadHookSecret, loadMeta, loadMlsState, loadTokenCache, makeEdgePipeFactory, normalizeHandle, performAgentCreation, performRegistration, processMlsWelcomes, renewalDueWithJitter, resolveAgent, resolveApiUrl, resolveConfigDir, resolveHandleViaWebFinger, resolveToUuid, saveAgentKeys, saveCredentials, saveHookSecret, savePqEncryptionKey, saveTokenCache, sendGroupInviteNotification, startTlsListener, syncMlsGroup, toBase64Url, validateEncryptionKey, validateSigningKey, validateSlug } from "@rine-network/core";
|
|
3
|
+
import { FUNNEL_TIERS, HttpClient, IdempotencyStore, RineApiError, UUID_RE, addMlsGroupMember, agentKeysExist, agentLabel, buildIssueCertDeps, cacheToken, connectTunnel, decryptGroupMessage, decryptMessage, decryptThreadRow, deleteHookSecret, encryptGroupMessage, encryptMessage, encryptMlsGroupMessage, ensureCert, externalJoinMlsGroup, fetchAgents, fetchAndIngestPendingSKDistributions, fetchOAuthToken, fetchRecipientKeys, formatError, fromBase64Url, generateAgentKeys, generateHookSecret, generatePqKeyPair, getAgentPublicKeys, getCredentialEntry, getOrCreateSenderKey, getOrRefreshToken, handleWebhookRequest, hasSpiffeEndpoint, ingestSenderKeyDistribution, initMlsGroup, isBareAgentName, isValidHookName, listMyInvites, loadAgentKeys, loadCredentials, loadHookSecret, loadMeta, loadMlsState, loadTokenCache, makeEdgePipeFactory, normalizeHandle, performAgentCreation, performRegistration, processMlsWelcomes, renewalDueWithJitter, resolveAgent, resolveApiUrl, resolveConfigDir, resolveHandleViaWebFinger, resolveToUuid, saveAgentKeys, saveCredentials, saveHookSecret, savePqEncryptionKey, saveTokenCache, sendGroupInviteNotification, startTlsListener, syncMlsGroup, toBase64Url, validateEncryptionKey, validateSigningKey, validateSlug, verifyIdentitySpiffe } from "@rine-network/core";
|
|
4
4
|
import readline from "node:readline";
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
@@ -329,6 +329,11 @@ function registerAgent(program) {
|
|
|
329
329
|
console.log("E2EE keys generated and stored locally.");
|
|
330
330
|
if (data.verification_words) console.log(`Verification words: ${data.verification_words}`);
|
|
331
331
|
if (data.poll_url) console.log(`Poll URL: ${data.poll_url}`);
|
|
332
|
+
if (data.identity) console.log(`SPIFFE identity verified: ${data.identity.spiffe_id} (trust tier ${data.identity.trust_tier})`);
|
|
333
|
+
}
|
|
334
|
+
if (data.identityError) {
|
|
335
|
+
printError(`Agent created, but SPIFFE identity verification failed: ${data.identityError}\nRetry with: rine verify-identity --agent ${data.id} --svid <jwt>`);
|
|
336
|
+
process.exitCode = 1;
|
|
332
337
|
}
|
|
333
338
|
}));
|
|
334
339
|
agent.command("list").description("List all agents").option("--include-revoked", "Include revoked agents").action(withClient(program, async ({ client, gOpts }, opts) => {
|
|
@@ -1507,7 +1512,7 @@ function registerMessages(program) {
|
|
|
1507
1512
|
//#endregion
|
|
1508
1513
|
//#region src/commands/onboard.ts
|
|
1509
1514
|
function registerOnboard(program) {
|
|
1510
|
-
program.command("onboard").description("Register a new organization and create your first agent").requiredOption("--email <email>", "Email address").requiredOption("--name <name>", "Organization name").requiredOption("--slug <slug>", "Organization slug").requiredOption("--agent <agent-name>", "Name for the first agent").option("--[no-]human-oversight", "Require human oversight (default: true)").option("--unlisted", "Mark agent as unlisted (not in public directory)").action(withErrorHandler(program, async (gOpts, opts) => {
|
|
1515
|
+
program.command("onboard").description("Register a new organization and create your first agent").requiredOption("--email <email>", "Email address").requiredOption("--name <name>", "Organization name").requiredOption("--slug <slug>", "Organization slug").requiredOption("--agent <agent-name>", "Name for the first agent").option("--[no-]human-oversight", "Require human oversight (default: true)").option("--unlisted", "Mark agent as unlisted (not in public directory)").option("--verify-identity", "After creating the agent, prove a SPIFFE identity (auto-runs when SPIFFE_ENDPOINT_SOCKET is set)").option("--svid <jwt>", "SPIFFE JWT-SVID to use for --verify-identity (when no Workload API auto-fetch is available)").action(withErrorHandler(program, async (gOpts, opts) => {
|
|
1511
1516
|
const profile = gOpts.profile ?? "default";
|
|
1512
1517
|
const configDir = resolveConfigDir();
|
|
1513
1518
|
const apiUrl = resolveApiUrl();
|
|
@@ -1549,13 +1554,17 @@ function registerOnboard(program) {
|
|
|
1549
1554
|
const agent = await performAgentCreation(client, configDir, profile, {
|
|
1550
1555
|
name: opts.agent,
|
|
1551
1556
|
humanOversight: opts.humanOversight,
|
|
1552
|
-
unlisted: opts.unlisted
|
|
1557
|
+
unlisted: opts.unlisted,
|
|
1558
|
+
verifyIdentity: opts.verifyIdentity || Boolean(opts.svid) || hasSpiffeEndpoint(),
|
|
1559
|
+
svid: opts.svid
|
|
1553
1560
|
});
|
|
1554
1561
|
if (gOpts.json) printJson({
|
|
1555
1562
|
org_id: regResult.org_id,
|
|
1556
1563
|
client_id: regResult.client_id,
|
|
1557
1564
|
agent,
|
|
1558
1565
|
poll_url: agent.poll_url,
|
|
1566
|
+
identity: agent.identity,
|
|
1567
|
+
identity_error: agent.identityError,
|
|
1559
1568
|
config_dir: configDir
|
|
1560
1569
|
});
|
|
1561
1570
|
else {
|
|
@@ -1566,6 +1575,11 @@ function registerOnboard(program) {
|
|
|
1566
1575
|
console.log(`\nAgent '${agent.name}' created — reachable at ${agent.handle}`);
|
|
1567
1576
|
if (agent.verification_words) console.log(`Verification words: ${agent.verification_words}`);
|
|
1568
1577
|
if (agent.poll_url) console.log(`Poll URL: ${agent.poll_url}`);
|
|
1578
|
+
if (agent.identity) console.log(`SPIFFE identity verified: ${agent.identity.spiffe_id} (trust tier ${agent.identity.trust_tier})`);
|
|
1579
|
+
}
|
|
1580
|
+
if (agent.identityError) {
|
|
1581
|
+
printError(`Agent created, but SPIFFE identity verification failed: ${agent.identityError}\nRetry with: rine verify-identity --agent ${agent.id} --svid <jwt>`);
|
|
1582
|
+
process.exitCode = 1;
|
|
1569
1583
|
}
|
|
1570
1584
|
}));
|
|
1571
1585
|
}
|
|
@@ -2239,6 +2253,24 @@ function registerStream(program) {
|
|
|
2239
2253
|
});
|
|
2240
2254
|
}
|
|
2241
2255
|
//#endregion
|
|
2256
|
+
//#region src/commands/verify-identity.ts
|
|
2257
|
+
function printResult(result) {
|
|
2258
|
+
console.log(`SPIFFE identity verified for agent ${result.agent_id}`);
|
|
2259
|
+
console.log(` SPIFFE ID: ${result.spiffe_id}`);
|
|
2260
|
+
console.log(` Trust domain: ${result.trust_domain}`);
|
|
2261
|
+
console.log(` Trust tier: ${result.trust_tier}`);
|
|
2262
|
+
console.log(` Verified at: ${result.verified_at}`);
|
|
2263
|
+
}
|
|
2264
|
+
function registerVerifyIdentity(program) {
|
|
2265
|
+
program.command("verify-identity").description("Prove control of a SPIFFE identity for an agent (elevates the org to trust tier 2)").option("--agent <id>", "Agent UUID, handle, or name (defaults to the only agent)").option("--svid <jwt>", "A SPIFFE JWT-SVID. Required unless a Workload API auto-fetch is available.").action(withClient(program, async (ctx, opts) => {
|
|
2266
|
+
const agents = await fetchAgents(ctx.client);
|
|
2267
|
+
const agentId = await resolveAgent(ctx.apiUrl, agents, opts.agent, ctx.gOpts.as);
|
|
2268
|
+
const result = await verifyIdentitySpiffe(ctx.client, agentId, { svid: opts.svid });
|
|
2269
|
+
if (ctx.gOpts.json) printJson(result);
|
|
2270
|
+
else printResult(result);
|
|
2271
|
+
}));
|
|
2272
|
+
}
|
|
2273
|
+
//#endregion
|
|
2242
2274
|
//#region src/commands/webhook.ts
|
|
2243
2275
|
function registerWebhook(program) {
|
|
2244
2276
|
const webhook = program.command("webhook").description("Manage webhooks");
|
|
@@ -2327,6 +2359,7 @@ registerKeys(program);
|
|
|
2327
2359
|
registerStream(program);
|
|
2328
2360
|
registerRelay(program);
|
|
2329
2361
|
registerPollToken(program);
|
|
2362
|
+
registerVerifyIdentity(program);
|
|
2330
2363
|
program.parse();
|
|
2331
2364
|
//#endregion
|
|
2332
2365
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rine-network/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "CLI client for rine.network \u2014 EU-first messaging infrastructure for AI agents",
|
|
5
5
|
"author": "mmmbs <mmmbs@proton.me>",
|
|
6
6
|
"license": "EUPL-1.2",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dev": "tsx src/main.ts"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@rine-network/core": "^0.
|
|
31
|
+
"@rine-network/core": "^0.8.0",
|
|
32
32
|
"commander": "^12.0.0",
|
|
33
33
|
"eventsource-client": "^1.1.0"
|
|
34
34
|
},
|