agental 0.56.0 → 0.57.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/cli.js +151 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7411,7 +7411,7 @@ import { parseArgs } from "node:util";
|
|
|
7411
7411
|
|
|
7412
7412
|
// ../src/cli-build.ts
|
|
7413
7413
|
var PUBLISHED = true;
|
|
7414
|
-
var CLI_VERSION = true ? "0.
|
|
7414
|
+
var CLI_VERSION = true ? "0.57.0" : "dev";
|
|
7415
7415
|
var DEFAULT_API_URL = true ? "https://agental.io" : "http://127.0.0.1:8741";
|
|
7416
7416
|
var PACKAGE_NAME = "agental";
|
|
7417
7417
|
var USER_AGENT = `agental-cli/${CLI_VERSION}`;
|
|
@@ -9614,12 +9614,18 @@ var COMMANDS = [
|
|
|
9614
9614
|
"agental guild attach <guild> <template> [--roles <role,...>] | detach <guild> <template>",
|
|
9615
9615
|
"agental guild mine",
|
|
9616
9616
|
"agental guild join <guild> --as <name> --role <role> [--answer <key=value>]...",
|
|
9617
|
-
"agental guild members <guild> | leave <guild> <identity> | handover <guild> <identity> <sandbox>"
|
|
9617
|
+
"agental guild members <guild> | leave <guild> <identity> | handover <guild> <identity> <sandbox>",
|
|
9618
|
+
"agental guild post <guild> <text> [--as <identity>] [--to <identity,...> | --to-role <role>] [--request] [--answers <request>]",
|
|
9619
|
+
"agental guild read <guild> [--as <identity>] [--wait-seconds <n>] [--done]",
|
|
9620
|
+
"agental guild requests <guild> | claim <guild> <request> | answer <guild> <request> <text> | close <guild> <request>",
|
|
9621
|
+
"agental guild notes <guild> [<identity>] [--text <notes>] | pause <guild> | resume <guild>"
|
|
9618
9622
|
],
|
|
9619
9623
|
examples: [
|
|
9620
9624
|
'agental guild create marketing --roles "blog manager:1,reviewer:2" --brief "Reviewers answer pass or fail."',
|
|
9621
9625
|
"agental guild attach marketing writers",
|
|
9622
|
-
"agental guild join marketing --as Atlas --role reviewer --answer model=claude"
|
|
9626
|
+
"agental guild join marketing --as Atlas --role reviewer --answer model=claude",
|
|
9627
|
+
'agental guild post marketing "Review a1b2c3, please." --to-role reviewer --request',
|
|
9628
|
+
"agental guild read marketing --wait-seconds 30 --done"
|
|
9623
9629
|
],
|
|
9624
9630
|
flags: [
|
|
9625
9631
|
["--roles <name[:seats],...>", "create: the roles, each with its seats; attach: the roles its sandboxes may take"],
|
|
@@ -9628,7 +9634,15 @@ var COMMANDS = [
|
|
|
9628
9634
|
["--as <name>", "join: the name you will be known by in the guild"],
|
|
9629
9635
|
["--role <role>", "join: one of the guild's roles with a free seat"],
|
|
9630
9636
|
["--answer <key=value>", "join: an answer to the guild's form (may be given again)"],
|
|
9631
|
-
["--yes", "delete: without asking"]
|
|
9637
|
+
["--yes", "delete: without asking"],
|
|
9638
|
+
["--to <identity,...>", "post: the identities it is for, by name or ID"],
|
|
9639
|
+
["--to-role <role>", "post: the role it is for"],
|
|
9640
|
+
["--request", "post: a request, open until answered"],
|
|
9641
|
+
["--answers <request>", "post: the request this answers and closes"],
|
|
9642
|
+
["--channel <name>", "post, read: the channel; general by default"],
|
|
9643
|
+
["--wait-seconds <n>", "read: wait up to n seconds (at most 30) for a message"],
|
|
9644
|
+
["--done", "read: confirm you are done with what was read, so the next read starts after it"],
|
|
9645
|
+
["--text <notes>", "notes: overwrite the identity's notes with this"]
|
|
9632
9646
|
]
|
|
9633
9647
|
},
|
|
9634
9648
|
{
|
|
@@ -10159,7 +10173,7 @@ var SUBCOMMANDS = {
|
|
|
10159
10173
|
limits: ["budget"],
|
|
10160
10174
|
egress: ["budget", "use-case"],
|
|
10161
10175
|
tailscale: ["status", "connect", "disconnect"],
|
|
10162
|
-
guild: ["list", "show", "create", "delete", "attach", "detach", "mine", "join", "members", "leave", "handover"],
|
|
10176
|
+
guild: ["list", "show", "create", "delete", "attach", "detach", "mine", "join", "members", "leave", "handover", "post", "read", "requests", "claim", "answer", "close", "notes", "pause", "resume"],
|
|
10163
10177
|
subscriptions: ["list", "sign-in", "delete"],
|
|
10164
10178
|
telemetry: ["set", "test", "unset"],
|
|
10165
10179
|
ci: ["jobs", "set", "reset"],
|
|
@@ -13881,7 +13895,7 @@ function createTailnet(given, flags2 = {}) {
|
|
|
13881
13895
|
|
|
13882
13896
|
// ../src/cli-guilds.ts
|
|
13883
13897
|
import { readFileSync as readFileSync7 } from "node:fs";
|
|
13884
|
-
var USAGE9 = "guild takes list, show
|
|
13898
|
+
var USAGE9 = "guild takes list, show, create, delete, attach, detach, mine, join, members, leave, handover, post, read, requests, claim, answer, close, notes, pause or resume. agental guild --help shows each.";
|
|
13885
13899
|
async function ask11(client, method, pathname, body) {
|
|
13886
13900
|
const response = await client.request(pathname, { method, ...body === void 0 ? {} : { body: JSON.stringify(body) } });
|
|
13887
13901
|
let answered = null;
|
|
@@ -13949,6 +13963,30 @@ function memberLine(member) {
|
|
|
13949
13963
|
return `${member.id} ${member.name}, ${member.role}, ${held}
|
|
13950
13964
|
`;
|
|
13951
13965
|
}
|
|
13966
|
+
async function actingAs(client, guild2, given) {
|
|
13967
|
+
if (given !== void 0) {
|
|
13968
|
+
return await memberNamed2(client, guild2, given);
|
|
13969
|
+
}
|
|
13970
|
+
const answer6 = await client.request("/v1/guilds/mine", { method: "GET" });
|
|
13971
|
+
const mine = answer6.ok ? (await answer6.json())["guilds"] ?? [] : [];
|
|
13972
|
+
const held = mine.filter((one) => one["guild"]["name"] === guild2).flatMap((one) => one["held"]);
|
|
13973
|
+
if (held.length === 1) {
|
|
13974
|
+
return held[0] ?? null;
|
|
13975
|
+
}
|
|
13976
|
+
if (held.length > 1) {
|
|
13977
|
+
throw new Error(`You hold ${held.length} identities in ${guild2}: say which with --as ${held.map((member) => member.name).join(" | ")}.`);
|
|
13978
|
+
}
|
|
13979
|
+
return null;
|
|
13980
|
+
}
|
|
13981
|
+
function messageLine(message) {
|
|
13982
|
+
const to = message.toRole ? ` to ${message.toRole}` : message.to ? ` to ${message.to.length} identit${message.to.length === 1 ? "y" : "ies"}` : "";
|
|
13983
|
+
const what = message.kind === "request" ? ` request ${message.id}${message.request?.open ? message.request.claimedBy ? ", taken" : ", open" : `, ${message.request?.closedReason ?? "closed"}`}` : message.kind === "answer" ? ` answer to ${message.answers ?? ""}` : "";
|
|
13984
|
+
return `#${message.seq} ${message.from.name}${to}${what}: ${message.text}
|
|
13985
|
+
`;
|
|
13986
|
+
}
|
|
13987
|
+
function channelOf(options) {
|
|
13988
|
+
return encodeURIComponent((options.channel ?? "general").replace(/^#/, ""));
|
|
13989
|
+
}
|
|
13952
13990
|
async function memberNamed2(client, guild2, given) {
|
|
13953
13991
|
const members2 = (await ask11(client, "GET", `${at4(guild2)}/members`))["members"] ?? [];
|
|
13954
13992
|
const found = members2.find((member) => member.id === given) ?? members2.find((member) => member.name.toLowerCase() === given.toLowerCase());
|
|
@@ -14068,6 +14106,94 @@ ${held}`;
|
|
|
14068
14106
|
const sandbox = await ask11(client, "GET", `/v1/sandboxes/${encodeURIComponent(needed(fourth, "handover takes a sandbox"))}`);
|
|
14069
14107
|
const handed = await ask11(client, "POST", `${at4(guildName)}/members/${encodeURIComponent(member.id)}/handover`, { sandboxId: String(sandbox["id"]) });
|
|
14070
14108
|
print4(options.json, handed, `${member.name} is held by ${String(sandbox["name"] ?? sandbox["id"])} now.
|
|
14109
|
+
`);
|
|
14110
|
+
return;
|
|
14111
|
+
}
|
|
14112
|
+
case "post": {
|
|
14113
|
+
const guildName = needed(name, "post takes a guild and the text");
|
|
14114
|
+
const text = needed(positionals.slice(2).join(" ") || options.text, "post takes the text, after the guild");
|
|
14115
|
+
const as = await actingAs(client, guildName, options.as);
|
|
14116
|
+
const members2 = options.to === void 0 ? [] : (await ask11(client, "GET", `${at4(guildName)}/members`))["members"] ?? [];
|
|
14117
|
+
const to = options.to?.split(",").map((one) => one.trim()).filter((one) => one !== "").map((one) => (members2.find((member) => member.id === one || member.name.toLowerCase() === one.toLowerCase()) ?? { id: one }).id);
|
|
14118
|
+
const posted = await ask11(client, "POST", `${at4(guildName)}/channels/${channelOf(options)}/messages`, {
|
|
14119
|
+
text,
|
|
14120
|
+
...as === null ? {} : { as: as.id },
|
|
14121
|
+
...to === void 0 ? {} : { to },
|
|
14122
|
+
...options.toRole === void 0 ? {} : { toRole: options.toRole },
|
|
14123
|
+
...options.request ? { request: true } : {},
|
|
14124
|
+
...options.answers === void 0 ? {} : { answers: options.answers },
|
|
14125
|
+
...options.retryKey === void 0 ? {} : { retryKey: options.retryKey }
|
|
14126
|
+
});
|
|
14127
|
+
print4(options.json, posted, messageLine(posted));
|
|
14128
|
+
return;
|
|
14129
|
+
}
|
|
14130
|
+
case "answer": {
|
|
14131
|
+
const guildName = needed(name, "answer takes a guild, a request and the text");
|
|
14132
|
+
await guild(client, ["post", guildName, ...positionals.slice(3)], { ...options, answers: needed(third, "answer takes the request's ID") });
|
|
14133
|
+
return;
|
|
14134
|
+
}
|
|
14135
|
+
case "read": {
|
|
14136
|
+
const guildName = needed(name, "read takes a guild");
|
|
14137
|
+
const as = await actingAs(client, guildName, options.as);
|
|
14138
|
+
const query = new URLSearchParams({
|
|
14139
|
+
...as === null ? {} : { as: as.id },
|
|
14140
|
+
...options.after === void 0 ? {} : { after: options.after },
|
|
14141
|
+
...options.waitSeconds === void 0 ? {} : { wait: options.waitSeconds }
|
|
14142
|
+
});
|
|
14143
|
+
const read2 = await ask11(client, "GET", `${at4(guildName)}/channels/${channelOf(options)}/messages?${query.toString()}`);
|
|
14144
|
+
const messages = read2["messages"] ?? [];
|
|
14145
|
+
const last = messages.at(-1);
|
|
14146
|
+
if (options.done && as !== null && last !== void 0) {
|
|
14147
|
+
await ask11(client, "POST", `${at4(guildName)}/channels/${channelOf(options)}/place`, { as: as.id, upTo: last.seq });
|
|
14148
|
+
}
|
|
14149
|
+
print4(options.json, read2, messages.map(messageLine).join("") || "No new messages.\n");
|
|
14150
|
+
return;
|
|
14151
|
+
}
|
|
14152
|
+
case "requests": {
|
|
14153
|
+
const guildName = needed(name, "requests takes a guild");
|
|
14154
|
+
const as = await actingAs(client, guildName, options.as);
|
|
14155
|
+
const found = await ask11(client, "GET", `${at4(guildName)}/requests${as === null ? "" : `?as=${encodeURIComponent(as.id)}`}`);
|
|
14156
|
+
const section = (title, list6) => list6.length ? `${title}
|
|
14157
|
+
${list6.map((one) => ` ${messageLine(one)}`).join("")}` : "";
|
|
14158
|
+
print4(options.json, found, section("you owe", found["owed"]) + section("you wait on", found["waiting"]) + section("open", found["open"]) || "No open requests.\n");
|
|
14159
|
+
return;
|
|
14160
|
+
}
|
|
14161
|
+
case "claim": {
|
|
14162
|
+
const guildName = needed(name, "claim takes a guild and a request");
|
|
14163
|
+
const as = await actingAs(client, guildName, options.as);
|
|
14164
|
+
if (as === null) {
|
|
14165
|
+
throw new Error(`claim takes the identity you hold in ${guildName}: --as <identity>.`);
|
|
14166
|
+
}
|
|
14167
|
+
const claimed = await ask11(client, "POST", `${at4(guildName)}/requests/${encodeURIComponent(needed(third, "claim takes the request's ID"))}/claim`, { as: as.id });
|
|
14168
|
+
print4(options.json, claimed, `${as.name} took request ${claimed.id} for 30 minutes. Answer it with agental guild answer ${guildName} ${claimed.id} <text>.
|
|
14169
|
+
`);
|
|
14170
|
+
return;
|
|
14171
|
+
}
|
|
14172
|
+
case "close": {
|
|
14173
|
+
const guildName = needed(name, "close takes a guild and a request");
|
|
14174
|
+
const as = await actingAs(client, guildName, options.as);
|
|
14175
|
+
const closed = await ask11(client, "POST", `${at4(guildName)}/requests/${encodeURIComponent(needed(third, "close takes the request's ID"))}/close`, as === null ? {} : { as: as.id });
|
|
14176
|
+
print4(options.json, closed, `Request ${closed.id} is closed (${closed.request?.closedReason ?? "closed"}).
|
|
14177
|
+
`);
|
|
14178
|
+
return;
|
|
14179
|
+
}
|
|
14180
|
+
case "notes": {
|
|
14181
|
+
const guildName = needed(name, "notes takes a guild");
|
|
14182
|
+
const member = third === void 0 ? await actingAs(client, guildName, options.as) : await memberNamed2(client, guildName, third);
|
|
14183
|
+
if (member === null) {
|
|
14184
|
+
throw new Error(`notes takes an identity: agental guild notes ${guildName} <identity>.`);
|
|
14185
|
+
}
|
|
14186
|
+
const path6 = `${at4(guildName)}/members/${encodeURIComponent(member.id)}/notes`;
|
|
14187
|
+
const notes = options.text === void 0 ? await ask11(client, "GET", path6) : await ask11(client, "PUT", path6, { text: options.text });
|
|
14188
|
+
print4(options.json, notes, `${String(notes["text"]) || `${member.name} has no notes yet.`}
|
|
14189
|
+
`);
|
|
14190
|
+
return;
|
|
14191
|
+
}
|
|
14192
|
+
case "pause":
|
|
14193
|
+
case "resume": {
|
|
14194
|
+
const found = await ask11(client, "POST", `${at4(needed(name, `${verb} takes a guild`))}/${verb}`);
|
|
14195
|
+
print4(options.json, found, verb === "pause" ? `${String(name)}'s agents are paused until you resume them.
|
|
14196
|
+
` : `${String(name)}'s agents may post again.
|
|
14071
14197
|
`);
|
|
14072
14198
|
return;
|
|
14073
14199
|
}
|
|
@@ -15466,6 +15592,14 @@ async function main() {
|
|
|
15466
15592
|
form: { type: "string" },
|
|
15467
15593
|
as: { type: "string" },
|
|
15468
15594
|
answer: { type: "string", multiple: true },
|
|
15595
|
+
// Guild messages: a role it is to, a request, the request it answers, the channel, a retry key, where to read from, and a place confirmed.
|
|
15596
|
+
"to-role": { type: "string" },
|
|
15597
|
+
request: { type: "boolean" },
|
|
15598
|
+
answers: { type: "string" },
|
|
15599
|
+
channel: { type: "string" },
|
|
15600
|
+
"retry-key": { type: "string" },
|
|
15601
|
+
after: { type: "string" },
|
|
15602
|
+
done: { type: "boolean" },
|
|
15469
15603
|
"revoke-keys": { type: "boolean", default: false },
|
|
15470
15604
|
// agental list in a terminal: every column, as piped.
|
|
15471
15605
|
wide: { type: "boolean", default: false },
|
|
@@ -15633,7 +15767,17 @@ async function main() {
|
|
|
15633
15767
|
...values.brief === void 0 ? {} : { brief: values.brief },
|
|
15634
15768
|
...values.form === void 0 ? {} : { form: values.form },
|
|
15635
15769
|
...values.as === void 0 ? {} : { as: values.as },
|
|
15636
|
-
...values.answer === void 0 ? {} : { answer: values.answer }
|
|
15770
|
+
...values.answer === void 0 ? {} : { answer: values.answer },
|
|
15771
|
+
...values.to === void 0 ? {} : { to: values.to },
|
|
15772
|
+
...values["to-role"] === void 0 ? {} : { toRole: values["to-role"] },
|
|
15773
|
+
...values.request === void 0 ? {} : { request: values.request },
|
|
15774
|
+
...values.answers === void 0 ? {} : { answers: values.answers },
|
|
15775
|
+
...values.channel === void 0 ? {} : { channel: values.channel },
|
|
15776
|
+
...values["retry-key"] === void 0 ? {} : { retryKey: values["retry-key"] },
|
|
15777
|
+
...values["wait-seconds"] === void 0 ? {} : { waitSeconds: values["wait-seconds"] },
|
|
15778
|
+
...values.after === void 0 ? {} : { after: values.after },
|
|
15779
|
+
...values.done === void 0 ? {} : { done: values.done },
|
|
15780
|
+
...values.text === void 0 ? {} : { text: values.text }
|
|
15637
15781
|
}
|
|
15638
15782
|
);
|
|
15639
15783
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agental",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
4
4
|
"description": "The agental command: Linux sandboxes for your agents, from the terminal. npx agental@latest signs you in and installs the agent skills.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "VERTIXER LTD",
|