teamclaws 2.0.10 → 2.0.12

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 CHANGED
@@ -91,7 +91,7 @@ Existing event names and schema version remain unchanged. The
91
91
  `login_browser_required` event provides the safe `url`, a `label` of
92
92
  `Sign in to TeamClaws`, and `account_guidance`. Display these immediately while
93
93
  login keeps running. Signed-out `auth_status` includes the non-executing
94
- `login_command: "teamclaws login --json"`; status never starts device authorization.
94
+ `login_command: "teamclaws login <email> --json"`; status never starts device authorization.
95
95
 
96
96
  When approval is pending, `pairing_browser_required` supplies the safe approval
97
97
  URL and public `user_code`. Automatic pairing emits no browser approval event.
@@ -192,7 +192,6 @@ a crash after that claim may consume it before it is displayed.
192
192
  ## Commands
193
193
 
194
194
  ```text
195
- npx teamclaws login
196
195
  npx teamclaws login <email>
197
196
  npx teamclaws auth status
198
197
  npx teamclaws logout
@@ -202,7 +201,7 @@ npx teamclaws pair status <server-identifier-or-canonical-workspace-address>
202
201
  npx teamclaws pair
203
202
  npx teamclaws pair <server-identifier-or-canonical-workspace-address> [--no-open]
204
203
  npx teamclaws shell <target> --command <text> [--json]
205
- npx teamclaws users add <target> <email> --role <user|staff|superuser> [--json]
204
+ npx teamclaws users add <target> <email> --role <user|staff|superuser> [--sudo] [--json]
206
205
  npx teamclaws chat start <target> --message <text>
207
206
  npx teamclaws chat send <target> --session-id <uuid> --message <text>
208
207
  npx teamclaws chat watch <target> --session-id <uuid> --request-id <uuid>
@@ -213,7 +212,8 @@ newline-delimited JSON event stream intended for automation.
213
212
 
214
213
  Pairing (including explicit targets), server listing, pair status, chat, and shell
215
214
  require a saved TeamClaws CLI authorization and its local machine key. Run
216
- `teamclaws login` first. Login uses the browser approval to bind a new key to
215
+ `teamclaws login <email>` first. Email is required; agents must ask for the user's TeamClaws email if it has not
216
+ been provided before starting login. Login uses the browser approval to bind a new key to
217
217
  your TeamClaws account; the CLI discards the temporary OAuth tokens. Later
218
218
  commands sign fresh proofs without repeating browser approval. Missing or
219
219
  revoked authorization exits with code 3 in both human and JSON modes. Help,
@@ -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")
@@ -277,7 +279,7 @@ export function parseArguments(arguments_) {
277
279
  return { action: "update", json };
278
280
  if (args[0] === "login") {
279
281
  if (args.length === 1)
280
- return { action: "login", json };
282
+ throw new TeamClawsError("invalid_command", "Ask the user for their TeamClaws email address, then run teamclaws login <email>.", { exitCode: 2 });
281
283
  if (args.length === 2 && !args[1].startsWith("-")) {
282
284
  return { action: "login", json, email: args[1] };
283
285
  }
@@ -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/auth.js CHANGED
@@ -27,7 +27,7 @@ export class AuthService {
27
27
  options.machineKeys ?? new OsMachineKeyProvider(this.store.root);
28
28
  }
29
29
  async login(email, signal) {
30
- const boundEmail = email === undefined ? undefined : parseLoginEmail(email);
30
+ const boundEmail = parseLoginEmail(email);
31
31
  const machineKey = await this.machineKeys.create();
32
32
  const pending = await this.startDevice(boundEmail, machineKey, signal);
33
33
  this.output.loginBrowser(pending.verification_uri_complete);
@@ -96,8 +96,7 @@ export class AuthService {
96
96
  scope: "basic",
97
97
  machine_jwk: JSON.stringify(machineKey.public_jwk),
98
98
  });
99
- if (email)
100
- form.set("email", email);
99
+ form.set("email", email);
101
100
  const response = await requestJson(this.fetcher, OAUTH_DEVICE_AUTHORIZATION_URL, {
102
101
  method: "POST",
103
102
  form,
@@ -165,7 +164,7 @@ export class AuthService {
165
164
  ...(signal ? { signal } : {}),
166
165
  });
167
166
  if (response.status === 401) {
168
- throw new TeamClawsError("invalid_authentication", "The TeamClaws CLI authorization is inactive. Run `teamclaws login` to authorize this computer again.", {
167
+ throw new TeamClawsError("invalid_authentication", "The TeamClaws CLI authorization is inactive. Run `teamclaws login <email>` to authorize this computer again.", {
169
168
  exitCode: 3,
170
169
  });
171
170
  }
@@ -273,7 +272,7 @@ function oauthError(status, body) {
273
272
  code = error === "invalid_grant" ? "invalid_authentication" : error;
274
273
  }
275
274
  const message = error === "invalid_grant"
276
- ? "The TeamClaws login is no longer valid. Run `teamclaws login` to authenticate."
275
+ ? "The TeamClaws login is no longer valid. Run `teamclaws login <email>` to authenticate."
277
276
  : "TeamClaws rejected the login request.";
278
277
  return new TeamClawsError(code, message, {
279
278
  retryable: status >= 500,
package/dist/broker.js CHANGED
@@ -23,7 +23,7 @@ export class BrokerClient {
23
23
  ...(signal ? { signal } : {}),
24
24
  });
25
25
  if (response.status === 401) {
26
- throw new TeamClawsError("invalid_authentication", "The TeamClaws CLI authorization is inactive. Run `teamclaws login` to authorize this computer again.", {
26
+ throw new TeamClawsError("invalid_authentication", "The TeamClaws CLI authorization is inactive. Run `teamclaws login <email>` to authorize this computer again.", {
27
27
  exitCode: 3,
28
28
  });
29
29
  }
package/dist/constants.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export const PACKAGE_NAME = "teamclaws";
2
- export const PACKAGE_VERSION = "2.0.10";
2
+ export const PACKAGE_VERSION = "2.0.12";
3
3
  export const CLIENT_NAME = "teamclaws-cli";
4
4
  export const CONTRACT_VERSION = 1;
5
5
  export const OUTPUT_SCHEMA_VERSION = 1;
package/dist/output.js CHANGED
@@ -59,7 +59,7 @@ export class Output {
59
59
  status,
60
60
  };
61
61
  if (status === "signed_out")
62
- event.login_command = "teamclaws login --json";
62
+ event.login_command = "teamclaws login <email> --json";
63
63
  if (user)
64
64
  event.user = user;
65
65
  if (expiresAt)
@@ -68,7 +68,7 @@ export class Output {
68
68
  if (!this.json) {
69
69
  this.stdout.write(status === "signed_in" && user
70
70
  ? `Signed in as ${user.display_name} (${user.email}).\n`
71
- : "Not signed in to TeamClaws. Run `teamclaws login` to sign in.\n");
71
+ : "Not signed in to TeamClaws. Run `teamclaws login <email>` to sign in.\n");
72
72
  }
73
73
  }
74
74
  logoutComplete(remoteConfirmed) {
@@ -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
  }
@@ -19,7 +19,7 @@ export class TargetAuthorization {
19
19
  async requireGrant() {
20
20
  const grant = await this.store.readAuthorization();
21
21
  if (!grant)
22
- throw new TeamClawsError("login_required", "Approve this CLI at TeamClaws with `teamclaws login` before using a workspace.", { exitCode: 3 });
22
+ throw new TeamClawsError("login_required", "Approve this CLI at TeamClaws with `teamclaws login <email>` before using a workspace.", { exitCode: 3 });
23
23
  return grant;
24
24
  }
25
25
  async accountHeadersFor(method, url) {
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teamclaws",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "description": "Official TeamClaws command-line client and agent skills",
5
5
  "license": "PolyForm-Shield-1.0.0",
6
6
  "homepage": "https://teamclaws.com",
@@ -135,7 +135,7 @@ invent a new idempotency key to hide uncertainty about whether a turn exists.
135
135
  ## Failure handling
136
136
 
137
137
  - `login_required` or `invalid_authentication` (exit 3): tell the user to run
138
- `teamclaws login` and stop; retain the existing workspace pairing.
138
+ `teamclaws login <email>` and stop; retain the existing workspace pairing.
139
139
  - `re_pair_required`: direct the user to TCChat Pair & Transfer.
140
140
  - `selection_unavailable`: use the advertised recommendation unless the user
141
141
  asks for another valid selection.
@@ -23,7 +23,6 @@ workspace user; user membership is a separate privilege.
23
23
  Use the official executable:
24
24
 
25
25
  ```text
26
- npx teamclaws login --json
27
26
  npx teamclaws login owner@example.com --json
28
27
  npx teamclaws auth status --json
29
28
  npx teamclaws logout --json
@@ -41,8 +40,11 @@ wakeup that preserves the process; report a limitation if neither is possible.
41
40
  Confirm the returned account after `login_complete` and exit 0, then immediately
42
41
  resume the authorized onboarding or pairing task. Denial, expiry, cancellation,
43
42
  and failure end the attempt; report the result without automatically restarting.
44
- Start without an email unless the user supplies one. Optional email is a bind
45
- sent to TeamClaws, not identity asserted by this process. Never transfer a
43
+ An email address is required. If the user has not provided their TeamClaws email,
44
+ ask for it and wait for their answer before starting login. Do not guess it from
45
+ their AI assistant account or invent an address. Pass the supplied email to
46
+ `teamclaws login <email> --json`. The email binds approval to that account; it is
47
+ not identity asserted by this process. Never transfer a
46
48
  model or harness token into this process. The client stores an authorization ID
47
49
  and protected local signing key; temporary OAuth tokens are discarded.
48
50
 
@@ -46,8 +46,9 @@ workspace user; user membership is a separate privilege.
46
46
 
47
47
  Run `teamclaws auth status --json`. If signed in, confirm the returned account
48
48
  and continue without another login. If signed out, follow
49
- [teamclaws-login](../teamclaws-login/SKILL.md): start `teamclaws login --json`
50
- without an email unless the user explicitly supplied one. Immediately show the
49
+ [teamclaws-login](../teamclaws-login/SKILL.md): ask for the user's TeamClaws email
50
+ if they have not provided it, wait for their answer, then start
51
+ `teamclaws login <email> --json` with that address. Immediately show the
51
52
  returned `login_browser_required.url` as **Sign in to TeamClaws** in chat and
52
53
  explain:
53
54