teamclaws 2.0.10 → 2.0.11
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/README.md +17 -1
- package/dist/app.js +6 -4
- package/dist/constants.js +1 -1
- package/dist/output.js +3 -3
- package/dist/users.js +21 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -202,7 +202,7 @@ npx teamclaws pair status <server-identifier-or-canonical-workspace-address>
|
|
|
202
202
|
npx teamclaws pair
|
|
203
203
|
npx teamclaws pair <server-identifier-or-canonical-workspace-address> [--no-open]
|
|
204
204
|
npx teamclaws shell <target> --command <text> [--json]
|
|
205
|
-
npx teamclaws users add <target> <email> --role <user|staff|superuser> [--json]
|
|
205
|
+
npx teamclaws users add <target> <email> --role <user|staff|superuser> [--sudo] [--json]
|
|
206
206
|
npx teamclaws chat start <target> --message <text>
|
|
207
207
|
npx teamclaws chat send <target> --session-id <uuid> --message <text>
|
|
208
208
|
npx teamclaws chat watch <target> --session-id <uuid> --request-id <uuid>
|
|
@@ -260,6 +260,19 @@ acceptance. Existing memberships and pending invitations are preserved without
|
|
|
260
260
|
promotion or resend. If a request has an uncertain network outcome, inspect the
|
|
261
261
|
invitation status before trying again; the command does not blindly retry it.
|
|
262
262
|
|
|
263
|
+
The owner can include `--sudo` when inviting a `superuser` to grant full sudo
|
|
264
|
+
access after acceptance:
|
|
265
|
+
|
|
266
|
+
```text
|
|
267
|
+
teamclaws users add <target> <email> --role superuser --sudo
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Omitting `--sudo` requests no sudo grant. The flag is rejected for `user` and
|
|
271
|
+
`staff` roles. Sudo follows the existing access-group membership. The CLI
|
|
272
|
+
requires the workspace to acknowledge the saved sudo selection before reporting
|
|
273
|
+
a new sudo invitation as successful. Existing members and pending invitations
|
|
274
|
+
remain unchanged even when the flag is supplied.
|
|
275
|
+
|
|
263
276
|
### Inspect users and invitation status
|
|
264
277
|
|
|
265
278
|
```text
|
|
@@ -272,6 +285,9 @@ records. An accepted invitation is historical evidence of acceptance; current
|
|
|
272
285
|
membership determines whether the person still has access. An expired pending
|
|
273
286
|
invitation is marked expired. Listing sends no invitations and changes no roles,
|
|
274
287
|
memberships, or invitation state. It requires a workspace with the users-list API.
|
|
288
|
+
When supplied by the workspace, each entry includes its saved `sudo_enabled`
|
|
289
|
+
status. An accepted invitation's selection is historical; the current member's
|
|
290
|
+
status determines their current access.
|
|
275
291
|
|
|
276
292
|
## Read chat history without a browser
|
|
277
293
|
|
package/dist/app.js
CHANGED
|
@@ -86,7 +86,7 @@ export async function run(arguments_, dependencies = {}, signal) {
|
|
|
86
86
|
if (parsed.action === "users_add") {
|
|
87
87
|
try {
|
|
88
88
|
await targetAuthorization.requireGrant();
|
|
89
|
-
const result = await runUsersAdd(store, dependencies.fetcher ?? fetch, parsed.target, parsed.email, parsed.role, targetAuthorization, signal);
|
|
89
|
+
const result = await runUsersAdd(store, dependencies.fetcher ?? fetch, parsed.target, parsed.email, parsed.role, parsed.sudoEnabled, targetAuthorization, signal);
|
|
90
90
|
output.usersAddResult(result);
|
|
91
91
|
return 0;
|
|
92
92
|
}
|
|
@@ -254,12 +254,13 @@ export function parseArguments(arguments_) {
|
|
|
254
254
|
const email = requiredPositional(args, 3).trim().toLowerCase();
|
|
255
255
|
const options = parseNamedOptions(args.slice(4), {
|
|
256
256
|
values: ["--role"],
|
|
257
|
-
booleans: [],
|
|
257
|
+
booleans: ["--sudo"],
|
|
258
258
|
});
|
|
259
259
|
const role = options.values["--role"];
|
|
260
260
|
if (!email ||
|
|
261
261
|
email.length > 254 ||
|
|
262
|
-
!["user", "staff", "superuser"].includes(role ?? "")
|
|
262
|
+
!["user", "staff", "superuser"].includes(role ?? "") ||
|
|
263
|
+
(options.flags.has("--sudo") && role !== "superuser"))
|
|
263
264
|
throw usageError();
|
|
264
265
|
return {
|
|
265
266
|
action: "users_add",
|
|
@@ -267,6 +268,7 @@ export function parseArguments(arguments_) {
|
|
|
267
268
|
target,
|
|
268
269
|
email,
|
|
269
270
|
role: role,
|
|
271
|
+
sudoEnabled: options.flags.has("--sudo"),
|
|
270
272
|
};
|
|
271
273
|
}
|
|
272
274
|
if (args.length === 0 || args[0] === "--help" || args[0] === "-h")
|
|
@@ -550,5 +552,5 @@ function usageError() {
|
|
|
550
552
|
});
|
|
551
553
|
}
|
|
552
554
|
export function helpText() {
|
|
553
|
-
return `TeamClaws ${PACKAGE_VERSION}\n\nUsage:\n teamclaws update [--json]\n teamclaws shell <target> --command <text> [--json]\n teamclaws users add <target> <email> --role <user|staff|superuser> [--json]\n teamclaws users list <target> [--json]\n teamclaws login [email] [--json]\n teamclaws auth status [--json]\n teamclaws logout [--revoke] [--json]\n teamclaws servers list [--json]\n teamclaws servers update <server-id> [--name <text>] [--description <text>] [--json]\n teamclaws pair status <server-identifier-or-canonical-workspace-address> [--json]\n teamclaws pair [server-identifier-or-canonical-workspace-address] [--no-open] [--json]\n teamclaws chat list <target> [--json]\n teamclaws chat history <target> [--json]\n teamclaws chat messages <target> --chat-id <uuid> [--after-message-id <n>] [--json]\n teamclaws chat capabilities <target> [--json]\n teamclaws chat start <target> --message <text> [selection options] [--json]\n teamclaws chat send <target> --session-id <uuid> --message <text> [--json]\n teamclaws chat watch <target> --session-id <uuid> --request-id <uuid> [resume cursors] [--json]\n\nPair status performs one bounded direct verification and stops. Pairing grants the standard host-issued credential. Chat commands use that credential directly against the selected workspace.\n`;
|
|
555
|
+
return `TeamClaws ${PACKAGE_VERSION}\n\nUsage:\n teamclaws update [--json]\n teamclaws shell <target> --command <text> [--json]\n teamclaws users add <target> <email> --role <user|staff|superuser> [--sudo] [--json]\n teamclaws users list <target> [--json]\n teamclaws login [email] [--json]\n teamclaws auth status [--json]\n teamclaws logout [--revoke] [--json]\n teamclaws servers list [--json]\n teamclaws servers update <server-id> [--name <text>] [--description <text>] [--json]\n teamclaws pair status <server-identifier-or-canonical-workspace-address> [--json]\n teamclaws pair [server-identifier-or-canonical-workspace-address] [--no-open] [--json]\n teamclaws chat list <target> [--json]\n teamclaws chat history <target> [--json]\n teamclaws chat messages <target> --chat-id <uuid> [--after-message-id <n>] [--json]\n teamclaws chat capabilities <target> [--json]\n teamclaws chat start <target> --message <text> [selection options] [--json]\n teamclaws chat send <target> --session-id <uuid> --message <text> [--json]\n teamclaws chat watch <target> --session-id <uuid> --request-id <uuid> [resume cursors] [--json]\n\nPair status performs one bounded direct verification and stops. Pairing grants the standard host-issued credential. Chat commands use that credential directly against the selected workspace.\n`;
|
|
554
556
|
}
|
package/dist/constants.js
CHANGED
package/dist/output.js
CHANGED
|
@@ -427,7 +427,7 @@ export class Output {
|
|
|
427
427
|
});
|
|
428
428
|
if (!this.json) {
|
|
429
429
|
const messages = {
|
|
430
|
-
invited: `Invitation sent for ${result.requested_role} access. Access begins after acceptance.`,
|
|
430
|
+
invited: `Invitation sent for ${result.requested_role} access${result.sudo_enabled === true ? " with sudo" : result.sudo_enabled === false ? " without sudo" : ""}. Access begins after acceptance.`,
|
|
431
431
|
already_pending: "An invitation is already pending; it was not resent.",
|
|
432
432
|
already_member: "Already a member; access unchanged.",
|
|
433
433
|
already_owner: "Already the owner; access unchanged.",
|
|
@@ -444,12 +444,12 @@ export class Output {
|
|
|
444
444
|
if (!this.json) {
|
|
445
445
|
this.stdout.write("Current members:\n");
|
|
446
446
|
for (const member of result.members)
|
|
447
|
-
this.stdout.write(`${member.email}: ${member.role}${member.is_owner ? " (owner)" : ""}\n`);
|
|
447
|
+
this.stdout.write(`${member.email}: ${member.role}${member.is_owner ? " (owner)" : ""}${member.sudo_enabled === true ? " — sudo enabled" : member.sudo_enabled === false ? " — sudo disabled" : ""}\n`);
|
|
448
448
|
if (!result.members.length)
|
|
449
449
|
this.stdout.write("No members returned.\n");
|
|
450
450
|
this.stdout.write("Invitations:\n");
|
|
451
451
|
for (const invite of result.invites)
|
|
452
|
-
this.stdout.write(`${invite.email}: ${invite.status}${invite.is_expired && invite.status === "pending" ? " (expired)" : ""} — ${invite.role}\n`);
|
|
452
|
+
this.stdout.write(`${invite.email}: ${invite.status}${invite.is_expired && invite.status === "pending" ? " (expired)" : ""} — ${invite.role}${invite.sudo_enabled === true ? " — sudo enabled" : invite.sudo_enabled === false ? " — sudo disabled" : ""}\n`);
|
|
453
453
|
if (!result.invites.length)
|
|
454
454
|
this.stdout.write("No pending or accepted invitations.\n");
|
|
455
455
|
}
|
package/dist/users.js
CHANGED
|
@@ -15,6 +15,8 @@ const failureMessages = {
|
|
|
15
15
|
mfa_required: "The owner must meet the existing MFA policy before adding users.",
|
|
16
16
|
invalid_email: "Enter a valid email address.",
|
|
17
17
|
invalid_role: "Choose user, staff, or superuser access.",
|
|
18
|
+
invalid_sudo_enabled: "Sudo access must be a boolean.",
|
|
19
|
+
sudo_requires_superuser: "Sudo access can only accompany superuser access.",
|
|
18
20
|
invalid_request: "The workspace rejected the add-user request.",
|
|
19
21
|
invite_delivery_failed: "The invitation could not be delivered. Check its status before retrying.",
|
|
20
22
|
outcome_unverified: "The invitation outcome could not be verified. Check its status before retrying.",
|
|
@@ -67,12 +69,16 @@ export async function runUsersList(store, fetcher, target, authorization, signal
|
|
|
67
69
|
if (!isObject(row) ||
|
|
68
70
|
!validEmail(row.email) ||
|
|
69
71
|
!roles.includes(String(row.role)) ||
|
|
70
|
-
typeof row.is_owner !== "boolean"
|
|
72
|
+
typeof row.is_owner !== "boolean" ||
|
|
73
|
+
(row.sudo_enabled !== undefined && typeof row.sudo_enabled !== "boolean"))
|
|
71
74
|
throw invalid();
|
|
72
75
|
return {
|
|
73
76
|
email: row.email,
|
|
74
77
|
role: row.role,
|
|
75
78
|
is_owner: row.is_owner,
|
|
79
|
+
...(typeof row.sudo_enabled === "boolean"
|
|
80
|
+
? { sudo_enabled: row.sudo_enabled }
|
|
81
|
+
: {}),
|
|
76
82
|
};
|
|
77
83
|
});
|
|
78
84
|
const invites = body.invites.map((row) => {
|
|
@@ -80,18 +86,22 @@ export async function runUsersList(store, fetcher, target, authorization, signal
|
|
|
80
86
|
!validEmail(row.email) ||
|
|
81
87
|
!roles.includes(String(row.role)) ||
|
|
82
88
|
!["pending", "accepted"].includes(String(row.status)) ||
|
|
83
|
-
typeof row.is_expired !== "boolean"
|
|
89
|
+
typeof row.is_expired !== "boolean" ||
|
|
90
|
+
(row.sudo_enabled !== undefined && typeof row.sudo_enabled !== "boolean"))
|
|
84
91
|
throw invalid();
|
|
85
92
|
return {
|
|
86
93
|
email: row.email,
|
|
87
94
|
role: row.role,
|
|
88
95
|
status: row.status,
|
|
89
96
|
is_expired: row.is_expired,
|
|
97
|
+
...(typeof row.sudo_enabled === "boolean"
|
|
98
|
+
? { sudo_enabled: row.sudo_enabled }
|
|
99
|
+
: {}),
|
|
90
100
|
};
|
|
91
101
|
});
|
|
92
102
|
return { ok: true, action: "list", scope: "access_group", members, invites };
|
|
93
103
|
}
|
|
94
|
-
export async function runUsersAdd(store, fetcher, target, email, role, authorization, signal) {
|
|
104
|
+
export async function runUsersAdd(store, fetcher, target, email, role, sudoEnabled, authorization, signal) {
|
|
95
105
|
const credential = await store.findWorkspace(target);
|
|
96
106
|
if (!credential)
|
|
97
107
|
throw new TeamClawsError("re_pair_required", "No saved pairing was found for this workspace. Pair it first.", { exitCode: 3 });
|
|
@@ -99,7 +109,7 @@ export async function runUsersAdd(store, fetcher, target, email, role, authoriza
|
|
|
99
109
|
try {
|
|
100
110
|
response = await requestTargetJson(fetcher, authorization, `${credential.origin}/teamclaws-admin/api/device-users/v1/add/`, credential, {
|
|
101
111
|
method: "POST",
|
|
102
|
-
body: { email, role },
|
|
112
|
+
body: { email, role, ...(sudoEnabled ? { sudo_enabled: true } : {}) },
|
|
103
113
|
timeoutMs: 60_000,
|
|
104
114
|
...(signal ? { signal } : {}),
|
|
105
115
|
});
|
|
@@ -135,6 +145,10 @@ export async function runUsersAdd(store, fetcher, target, email, role, authoriza
|
|
|
135
145
|
body.scope !== "access_group" ||
|
|
136
146
|
body.email !== email ||
|
|
137
147
|
body.requested_role !== role ||
|
|
148
|
+
(body.sudo_enabled !== undefined &&
|
|
149
|
+
typeof body.sudo_enabled !== "boolean") ||
|
|
150
|
+
(sudoEnabled && typeof body.sudo_enabled !== "boolean") ||
|
|
151
|
+
(sudoEnabled && body.code === "invited" && body.sudo_enabled !== true) ||
|
|
138
152
|
!((response.status === 201 && body.code === "invited") ||
|
|
139
153
|
(response.status === 200 &&
|
|
140
154
|
["already_pending", "already_member", "already_owner"].includes(String(body.code)))))
|
|
@@ -146,5 +160,8 @@ export async function runUsersAdd(store, fetcher, target, email, role, authoriza
|
|
|
146
160
|
scope: "access_group",
|
|
147
161
|
email,
|
|
148
162
|
requested_role: role,
|
|
163
|
+
...(typeof body.sudo_enabled === "boolean"
|
|
164
|
+
? { sudo_enabled: body.sudo_enabled }
|
|
165
|
+
: {}),
|
|
149
166
|
};
|
|
150
167
|
}
|