@rine-network/cli 0.10.0 → 0.10.2

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 (2) hide show
  1. package/dist/main.js +28 -1
  2. 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 } from "commander";
3
- import { HttpClient, RineApiError, UUID_RE, addMlsGroupMember, agentKeysExist, cacheToken, decryptGroupMessage, decryptMessage, encryptGroupMessage, encryptMessage, encryptMlsGroupMessage, externalJoinMlsGroup, fetchAgents, fetchAndIngestPendingSKDistributions, fetchOAuthToken, fetchRecipientKeys, formatError, fromBase64Url, generateAgentKeys, generatePqKeyPair, getAgentPublicKeys, getCredentialEntry, getOrCreateSenderKey, getOrRefreshToken, ingestSenderKeyDistribution, initMlsGroup, isBareAgentName, loadAgentKeys, loadCredentials, loadMlsState, loadTokenCache, normalizeHandle, performAgentCreation, performRegistration, processMlsWelcomes, resolveAgent, resolveApiUrl, resolveConfigDir, resolveHandleViaWebFinger, resolveToUuid, saveAgentKeys, saveCredentials, savePqEncryptionKey, saveTokenCache, syncMlsGroup, toBase64Url, validateEncryptionKey, validateSigningKey, validateSlug } from "@rine-network/core";
3
+ import { HttpClient, RineApiError, UUID_RE, addMlsGroupMember, agentKeysExist, cacheToken, decryptGroupMessage, decryptMessage, encryptGroupMessage, encryptMessage, encryptMlsGroupMessage, externalJoinMlsGroup, fetchAgents, fetchAndIngestPendingSKDistributions, fetchOAuthToken, fetchRecipientKeys, formatError, fromBase64Url, generateAgentKeys, generatePqKeyPair, getAgentPublicKeys, getCredentialEntry, getOrCreateSenderKey, getOrRefreshToken, ingestSenderKeyDistribution, initMlsGroup, isBareAgentName, listMyInvites, loadAgentKeys, loadCredentials, loadMlsState, loadTokenCache, normalizeHandle, performAgentCreation, performRegistration, processMlsWelcomes, resolveAgent, resolveApiUrl, resolveConfigDir, resolveHandleViaWebFinger, resolveToUuid, saveAgentKeys, saveCredentials, savePqEncryptionKey, saveTokenCache, sendGroupInviteNotification, syncMlsGroup, toBase64Url, validateEncryptionKey, validateSigningKey, validateSlug } from "@rine-network/core";
4
4
  import readline from "node:readline";
5
5
  import * as fs from "node:fs";
6
6
  import { join } from "node:path";
@@ -711,6 +711,18 @@ async function addMemberToMls(client, configDir, apiUrl, groupId, memberAgentId,
711
711
  if (!json) printText(`Warning: MLS add-member failed: ${err instanceof Error ? err.message : String(err)}`);
712
712
  }
713
713
  }
714
+ async function sendInviteNotification(client, configDir, apiUrl, groupId, inviteeAgentId, message, as, json) {
715
+ try {
716
+ const group = await client.get(`/groups/${groupId}`);
717
+ await sendGroupInviteNotification(client, configDir, await resolveAgent(apiUrl, await fetchAgents(client), void 0, as), inviteeAgentId, {
718
+ group_id: groupId,
719
+ group_handle: group.handle,
720
+ message: message ?? null
721
+ });
722
+ } catch (err) {
723
+ if (!json) printText(`Warning: invite notification failed: ${err instanceof Error ? err.message : String(err)}`);
724
+ }
725
+ }
714
726
  function groupRow(g) {
715
727
  return {
716
728
  ID: g.id,
@@ -754,6 +766,15 @@ function requestRow(r) {
754
766
  Created: r.created_at
755
767
  };
756
768
  }
769
+ function inviteRow(r) {
770
+ return {
771
+ Group: r.group_handle ?? r.group_name ?? "",
772
+ "Group ID": r.group_id,
773
+ "Invited By": r.invited_by ?? "",
774
+ Message: r.message ?? "",
775
+ Created: r.created_at
776
+ };
777
+ }
757
778
  function registerGroup(program) {
758
779
  const group = program.command("group").description("Group management");
759
780
  group.command("create").description("Create a new group").requiredOption("--name <name>", "Group name (DNS-safe slug)").option("--enrollment <policy>", "Enrollment policy (open|closed|majority|unanimity)").option("--visibility <vis>", "Visibility (public|private)").option("--isolated", "Isolate group communication").option("--vote-duration <hours>", "Vote duration in hours (1-72)").action(withClient(program, async ({ client, gOpts, configDir, apiUrl }, opts) => {
@@ -852,6 +873,7 @@ function registerGroup(program) {
852
873
  if (opts.message) body.message = opts.message;
853
874
  const data = await client.post(`/groups/${groupId}/invite`, body);
854
875
  await addMemberToMls(client, configDir, apiUrl, groupId, agentId, gOpts.as, gOpts.json);
876
+ await sendInviteNotification(client, configDir, apiUrl, groupId, agentId, opts.message, gOpts.as, gOpts.json);
855
877
  if (gOpts.json) printJson(data);
856
878
  else {
857
879
  printText("Invitation sent");
@@ -863,6 +885,11 @@ function registerGroup(program) {
863
885
  if (gOpts.json) printJson(data);
864
886
  else printTable(data.items.map(requestRow));
865
887
  }));
888
+ group.command("invites").description("List group invitations addressed to you").action(withClient(program, async ({ client, gOpts, extraHeaders }) => {
889
+ const items = await listMyInvites(client, extraHeaders);
890
+ if (gOpts.json) printJson(items);
891
+ else printTable(items.map(inviteRow));
892
+ }));
866
893
  group.command("vote").description("Vote on a join request").argument("<group-id>", "Group ID").argument("<request-id>", "Join request ID").requiredOption("--vote <vote>", "Vote: approve or deny").action(withClient(program, async ({ client, gOpts, configDir, apiUrl }, groupId, requestId, opts) => {
867
894
  if (opts.vote !== "approve" && opts.vote !== "deny") {
868
895
  printError("--vote must be 'approve' or 'deny'");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rine-network/cli",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
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.5.0",
31
+ "@rine-network/core": "^0.5.2",
32
32
  "commander": "^12.0.0",
33
33
  "eventsource-client": "^1.1.0"
34
34
  },