@rine-network/cli 0.9.3 → 0.9.5
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 +60 -28
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -156,6 +156,32 @@ function getAgentCmd(program) {
|
|
|
156
156
|
if (!cmd) throw new Error("registerAgent must be called before registerAgentProfile");
|
|
157
157
|
return cmd;
|
|
158
158
|
}
|
|
159
|
+
const CSV_FIELD_CMDS = [
|
|
160
|
+
{
|
|
161
|
+
name: "set-categories",
|
|
162
|
+
desc: "Set agent categories",
|
|
163
|
+
flag: "--categories <cats>",
|
|
164
|
+
flagDesc: "Comma-separated category names",
|
|
165
|
+
field: "categories",
|
|
166
|
+
msg: "Categories updated"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: "set-languages",
|
|
170
|
+
desc: "Set agent supported languages",
|
|
171
|
+
flag: "--languages <langs>",
|
|
172
|
+
flagDesc: "Comma-separated language codes",
|
|
173
|
+
field: "languages",
|
|
174
|
+
msg: "Languages updated"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "accept-types",
|
|
178
|
+
desc: "Set accepted message types",
|
|
179
|
+
flag: "--types <types>",
|
|
180
|
+
flagDesc: "Comma-separated message types",
|
|
181
|
+
field: "message_types_accepted",
|
|
182
|
+
msg: "Accept types updated"
|
|
183
|
+
}
|
|
184
|
+
];
|
|
159
185
|
function registerAgentProfile(program) {
|
|
160
186
|
const agent = getAgentCmd(program);
|
|
161
187
|
agent.command("profile").description("Get agent card").argument("<agent-id>", "Agent ID").action(withClient(program, async ({ client, gOpts }, agentId) => {
|
|
@@ -164,14 +190,13 @@ function registerAgentProfile(program) {
|
|
|
164
190
|
else printTable([toRow(card)]);
|
|
165
191
|
}));
|
|
166
192
|
agent.command("describe").description("Update agent description").argument("<agent-id>", "Agent ID").requiredOption("--description <desc>", "Agent description").action(withClient(program, async ({ client, gOpts }, agentId, opts) => {
|
|
167
|
-
|
|
193
|
+
await updateCard(client, agentId, (card) => {
|
|
168
194
|
card.description = opts.description;
|
|
169
195
|
});
|
|
170
|
-
|
|
171
|
-
else printSuccess("Description updated");
|
|
196
|
+
printMutationOk("Description updated", gOpts.json);
|
|
172
197
|
}));
|
|
173
198
|
agent.command("add-skill").description("Add a skill to the agent card").argument("<agent-id>", "Agent ID").requiredOption("--skill-id <id>", "Skill ID").requiredOption("--skill-name <name>", "Skill name").option("--skill-description <desc>", "Skill description").option("--tags <tags>", "Comma-separated tags").option("--examples <examples>", "Comma-separated examples").option("--input-modes <modes>", "Comma-separated input modes").option("--output-modes <modes>", "Comma-separated output modes").action(withClient(program, async ({ client, gOpts }, agentId, opts) => {
|
|
174
|
-
|
|
199
|
+
await updateCard(client, agentId, (card) => {
|
|
175
200
|
const skill = {
|
|
176
201
|
id: opts.skillId,
|
|
177
202
|
name: opts.skillName,
|
|
@@ -183,20 +208,7 @@ function registerAgentProfile(program) {
|
|
|
183
208
|
if (opts.outputModes) skill.outputModes = opts.outputModes.split(",").map((m) => m.trim());
|
|
184
209
|
card.skills = [...Array.isArray(card.skills) ? card.skills : [], skill];
|
|
185
210
|
});
|
|
186
|
-
|
|
187
|
-
else printSuccess("Skill added");
|
|
188
|
-
}));
|
|
189
|
-
agent.command("set-categories").description("Set agent categories").argument("<agent-id>", "Agent ID").requiredOption("--categories <cats>", "Comma-separated category names").action(withClient(program, async ({ client, gOpts }, agentId, opts) => {
|
|
190
|
-
const cats = opts.categories.split(",").map((c) => c.trim());
|
|
191
|
-
const result = await updateCard(client, agentId, (card) => setRineField(card, "categories", cats));
|
|
192
|
-
if (gOpts.json) printJson(result);
|
|
193
|
-
else printSuccess("Categories updated");
|
|
194
|
-
}));
|
|
195
|
-
agent.command("set-languages").description("Set agent supported languages").argument("<agent-id>", "Agent ID").requiredOption("--languages <langs>", "Comma-separated language codes").action(withClient(program, async ({ client, gOpts }, agentId, opts) => {
|
|
196
|
-
const langs = opts.languages.split(",").map((l) => l.trim());
|
|
197
|
-
const result = await updateCard(client, agentId, (card) => setRineField(card, "languages", langs));
|
|
198
|
-
if (gOpts.json) printJson(result);
|
|
199
|
-
else printSuccess("Languages updated");
|
|
211
|
+
printMutationOk("Skill added", gOpts.json);
|
|
200
212
|
}));
|
|
201
213
|
agent.command("set-pricing").description("Set agent pricing model").argument("<agent-id>", "Agent ID").requiredOption("--model <model>", `Pricing model (${VALID_PRICING.join("|")})`).action(withClient(program, async ({ client, gOpts }, agentId, opts) => {
|
|
202
214
|
if (!VALID_PRICING.includes(opts.model)) {
|
|
@@ -204,15 +216,27 @@ function registerAgentProfile(program) {
|
|
|
204
216
|
process.exitCode = 2;
|
|
205
217
|
return;
|
|
206
218
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
219
|
+
await updateCard(client, agentId, (card) => setRineField(card, "pricing_model", opts.model));
|
|
220
|
+
printMutationOk("Pricing updated", gOpts.json);
|
|
221
|
+
}));
|
|
222
|
+
for (const def of CSV_FIELD_CMDS) agent.command(def.name).description(def.desc).argument("<agent-id>", "Agent ID").requiredOption(def.flag, def.flagDesc).action(withClient(program, async ({ client, gOpts }, agentId, opts) => {
|
|
223
|
+
const raw = Object.values(opts)[0];
|
|
224
|
+
await updateCard(client, agentId, (card) => setRineField(card, def.field, raw.split(",").map((s) => s.trim())));
|
|
225
|
+
printMutationOk(def.msg, gOpts.json);
|
|
226
|
+
}));
|
|
227
|
+
agent.command("enable-a2a").description("Enable A2A protocol bridge for this agent").argument("<agent-id>", "Agent ID").action(withClient(program, async ({ client, gOpts }, agentId) => {
|
|
228
|
+
const result = await updateCard(client, agentId, (card) => setRineField(card, "a2a_enabled", true));
|
|
229
|
+
if (gOpts.json) {
|
|
230
|
+
printJson(result);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
const endpoint = (result.rine ?? {}).a2a_endpoint;
|
|
234
|
+
if (endpoint) printSuccess(`A2A enabled. Endpoint: ${endpoint}`);
|
|
235
|
+
else printSuccess("A2A enabled (endpoint not yet set by server)");
|
|
210
236
|
}));
|
|
211
|
-
agent.command("
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (gOpts.json) printJson(result);
|
|
215
|
-
else printSuccess("Accept types updated");
|
|
237
|
+
agent.command("disable-a2a").description("Disable A2A protocol bridge for this agent").argument("<agent-id>", "Agent ID").action(withClient(program, async ({ client, gOpts }, agentId) => {
|
|
238
|
+
await updateCard(client, agentId, (card) => setRineField(card, "a2a_enabled", false));
|
|
239
|
+
printMutationOk("A2A disabled", gOpts.json);
|
|
216
240
|
}));
|
|
217
241
|
}
|
|
218
242
|
//#endregion
|
|
@@ -1006,7 +1030,7 @@ function inboxRow(m) {
|
|
|
1006
1030
|
From: msgFrom(m),
|
|
1007
1031
|
Group: msgGroup(m),
|
|
1008
1032
|
Type: m.type,
|
|
1009
|
-
|
|
1033
|
+
Status: (m.status ?? "new").toUpperCase(),
|
|
1010
1034
|
Created: m.created_at
|
|
1011
1035
|
};
|
|
1012
1036
|
}
|
|
@@ -1126,9 +1150,17 @@ function addMessageCommands(parent, program) {
|
|
|
1126
1150
|
Created: data.created_at
|
|
1127
1151
|
}]);
|
|
1128
1152
|
}));
|
|
1129
|
-
parent.command("inbox").description("List inbox messages").option("--agent <id>", "Agent ID (defaults to your agent)").option("--limit <n>", "Maximum number of messages to return").option("--cursor <cursor>", "Pagination cursor").action(withClient(program, async ({ client, gOpts, apiUrl }, opts) => {
|
|
1153
|
+
parent.command("inbox").description("List inbox messages").option("--agent <id>", "Agent ID (defaults to your agent)").option("--new", "Show only new (undelivered) messages").option("--delivered", "Show only delivered messages").option("--read", "Show only read messages").option("--limit <n>", "Maximum number of messages to return").option("--cursor <cursor>", "Pagination cursor").action(withClient(program, async ({ client, gOpts, apiUrl }, opts) => {
|
|
1154
|
+
if ([
|
|
1155
|
+
opts.new,
|
|
1156
|
+
opts.delivered,
|
|
1157
|
+
opts.read
|
|
1158
|
+
].filter(Boolean).length > 1) throw new Error("Only one of --new, --delivered, --read can be specified");
|
|
1130
1159
|
const agentId = await resolveAgent(apiUrl, await fetchAgents(client), opts.agent, gOpts.as);
|
|
1131
1160
|
const params = {};
|
|
1161
|
+
if (opts.new) params.status = "new";
|
|
1162
|
+
else if (opts.delivered) params.status = "delivered";
|
|
1163
|
+
else if (opts.read) params.status = "read";
|
|
1132
1164
|
if (opts.limit) params.limit = opts.limit;
|
|
1133
1165
|
if (opts.cursor) params.cursor = opts.cursor;
|
|
1134
1166
|
const data = await client.get(`/agents/${agentId}/messages`, params);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rine-network/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
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.
|
|
31
|
+
"@rine-network/core": "^0.4.3",
|
|
32
32
|
"commander": "^12.0.0",
|
|
33
33
|
"eventsource-client": "^1.1.0"
|
|
34
34
|
},
|