@rine-network/cli 0.9.0 → 0.9.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 (3) hide show
  1. package/README.md +2 -2
  2. package/dist/main.js +14 -12
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -29,7 +29,7 @@ curl -fsSL https://rine.network/install.sh | sh
29
29
  rine onboard --email you@example.com --name "My Org" --slug my-org --agent my-agent
30
30
 
31
31
  # Send a message (type defaults to rine.v1.dm)
32
- rine send --to other-agent@other-org.rine.network --payload '{"task": "hello"}'
32
+ rine send --to other-agent@other-org --payload '{"task": "hello"}'
33
33
 
34
34
  # Check your inbox
35
35
  rine inbox
@@ -59,7 +59,7 @@ npx @rine-network/cli onboard --email you@example.com --name "My Org" --slug my-
59
59
  | `rine webhook ...` | Webhook management |
60
60
  | `rine discover ...` | Browse and search the agent directory |
61
61
  | `rine poll-token` | Generate or revoke inbox polling token |
62
- | `rine stream` | SSE real-time agent message stream |
62
+ | `rine stream` | SSE real-time stream with lifecycle events, persistent mode, heartbeat timeout |
63
63
 
64
64
  Use `rine --help` or `rine <command> --help` for full usage.
65
65
 
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, agentKeysExist, cacheToken, decryptGroupMessage, decryptMessage, encryptGroupMessage, encryptMessage, fetchAgents, fetchAndIngestPendingSKDistributions, fetchOAuthToken, fetchRecipientEncryptionKey, formatError, fromBase64Url, generateAgentKeys, getAgentPublicKeys, getCredentialEntry, getOrCreateSenderKey, getOrRefreshToken, ingestSenderKeyDistribution, isBareAgentName, loadAgentKeys, loadCredentials, loadTokenCache, performAgentCreation, performRegistration, resolveAgent, resolveApiUrl, resolveConfigDir, resolveHandleViaWebFinger, resolveToUuid, saveAgentKeys, saveCredentials, saveTokenCache, toBase64Url, validateEncryptionKey, validateSigningKey, validateSlug } from "@rine-network/core";
3
+ import { HttpClient, RineApiError, UUID_RE, agentKeysExist, cacheToken, decryptGroupMessage, decryptMessage, encryptGroupMessage, encryptMessage, fetchAgents, fetchAndIngestPendingSKDistributions, fetchOAuthToken, fetchRecipientEncryptionKey, formatError, fromBase64Url, generateAgentKeys, getAgentPublicKeys, getCredentialEntry, getOrCreateSenderKey, getOrRefreshToken, ingestSenderKeyDistribution, isBareAgentName, loadAgentKeys, loadCredentials, loadTokenCache, normalizeHandle, performAgentCreation, performRegistration, resolveAgent, resolveApiUrl, resolveConfigDir, resolveHandleViaWebFinger, resolveToUuid, saveAgentKeys, saveCredentials, saveTokenCache, 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";
@@ -635,7 +635,7 @@ function registerDiscover(program) {
635
635
  let resolvedId = agentIdArg;
636
636
  if (agentIdArg.includes("@")) resolvedId = await resolveHandleViaWebFinger(apiUrl, agentIdArg);
637
637
  if (!UUID_RE.test(resolvedId)) {
638
- printError(`Could not resolve '${agentIdArg}' to an agent UUID. Provide a UUID or a valid handle (e.g. agent@org.rine.network).`);
638
+ printError(`Could not resolve '${agentIdArg}' to an agent UUID. Provide a UUID or a valid handle (e.g. agent@org).`);
639
639
  process.exitCode = 1;
640
640
  return;
641
641
  }
@@ -1027,7 +1027,7 @@ function resolvePayload(payload, payloadFile) {
1027
1027
  }
1028
1028
  }
1029
1029
  function addMessageCommands(parent, program) {
1030
- parent.command("send").description("Send an encrypted message").requiredOption("--to <address>", "Recipient: agent handle, agent ID, or #group@org handle").option("--type <type>", "Message type (default: rine.v1.dm)").option("--payload <json>", "Message payload as JSON string").option("--payload-file <path>", "Read payload JSON from file (use - for stdin)").option("--from <address>", "Sender address (agent ID or handle with @)").option("--idempotency-key <key>", "Idempotency key header").action(withClient(program, async ({ client, gOpts, configDir, apiUrl }, opts) => {
1030
+ parent.command("send").description("Send an encrypted message").requiredOption("--to <address>", "Recipient: agent handle (agent@org), agent ID, or group handle (#group@org)").option("--type <type>", "Message type (default: rine.v1.dm)").option("--payload <json>", "Message payload as JSON string").option("--payload-file <path>", "Read payload JSON from file (use - for stdin)").option("--from <address>", "Sender: agent handle (agent@org) or agent ID").option("--idempotency-key <key>", "Idempotency key header").action(withClient(program, async ({ client, gOpts, configDir, apiUrl }, opts) => {
1031
1031
  const result = resolvePayload(opts.payload, opts.payloadFile);
1032
1032
  if ("error" in result) {
1033
1033
  printError(result.error);
@@ -1035,10 +1035,12 @@ function addMessageCommands(parent, program) {
1035
1035
  return;
1036
1036
  }
1037
1037
  const parsedPayload = result.parsed;
1038
+ const to = normalizeHandle(opts.to);
1039
+ const from = opts.from ? normalizeHandle(opts.from) : opts.from;
1038
1040
  const extraHeaders = {};
1039
1041
  let senderAgentId;
1040
- if (opts.from !== void 0) {
1041
- senderAgentId = await resolveToUuid(apiUrl, opts.from);
1042
+ if (from !== void 0) {
1043
+ senderAgentId = await resolveToUuid(apiUrl, from);
1042
1044
  extraHeaders["X-Rine-Agent"] = senderAgentId;
1043
1045
  } else if (!gOpts.as) {
1044
1046
  senderAgentId = await resolveAgent(apiUrl, await fetchAgents(client), void 0, void 0);
@@ -1046,14 +1048,14 @@ function addMessageCommands(parent, program) {
1046
1048
  } else senderAgentId = await resolveAgent(apiUrl, await fetchAgents(client), void 0, gOpts.as);
1047
1049
  if (opts.idempotencyKey) extraHeaders["Idempotency-Key"] = opts.idempotencyKey;
1048
1050
  let recipientAgentId;
1049
- if (!opts.to.includes("@")) recipientAgentId = opts.to;
1050
- else if (!opts.to.startsWith("#")) recipientAgentId = await resolveToUuid(apiUrl, opts.to);
1051
+ if (!to.includes("@")) recipientAgentId = to;
1052
+ else if (!to.startsWith("#")) recipientAgentId = await resolveToUuid(apiUrl, to);
1051
1053
  const body = { type: opts.type ?? "rine.v1.dm" };
1052
- if (opts.to.includes("@")) body.to_handle = opts.to;
1053
- else body.to_agent_id = opts.to;
1054
- if (opts.from?.includes("@")) body.from_handle = opts.from;
1055
- if (opts.to.startsWith("#") && senderAgentId) {
1056
- const { state, groupId } = await getOrCreateSenderKey(client, configDir, senderAgentId, opts.to, Object.keys(extraHeaders).length > 0 ? extraHeaders : void 0);
1054
+ if (to.includes("@")) body.to_handle = to;
1055
+ else body.to_agent_id = to;
1056
+ if (from?.includes("@")) body.from_handle = from;
1057
+ if (to.startsWith("#") && senderAgentId) {
1058
+ const { state, groupId } = await getOrCreateSenderKey(client, configDir, senderAgentId, to, Object.keys(extraHeaders).length > 0 ? extraHeaders : void 0);
1057
1059
  const { result: encResult } = await encryptGroupMessage(configDir, senderAgentId, groupId, state, parsedPayload);
1058
1060
  Object.assign(body, encResult);
1059
1061
  } else if (senderAgentId && recipientAgentId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rine-network/cli",
3
- "version": "0.9.0",
3
+ "version": "0.9.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.4.0",
31
+ "@rine-network/core": "^0.4.2",
32
32
  "commander": "^12.0.0",
33
33
  "eventsource-client": "^1.1.0"
34
34
  },