teamclaws 2.0.9 → 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 CHANGED
@@ -124,7 +124,7 @@ request. Test a required-yield environment separately if automatic wakeup is
124
124
  used. Local CLI tests establish process behavior, not automatic loading or
125
125
  compliance in every agent environment.
126
126
 
127
- `servers list` requests `GET /api/cli/v1/servers/?include_inventory=1&include_description=1&include_editable_metadata=1`. Updated
127
+ `servers list` requests `GET /api/cli/v1/servers/?include_inventory=1&include_description=1&include_editable_metadata=1&include_subscription=1`. Updated
128
128
  brokers return `servers` and `workspace_count`: the count of all non-deleted
129
129
  owned and eligible shared workspaces, including those without a hostname yet.
130
130
  Individual server entries retain aliases, stable IDs, status and `pairing_ready`.
@@ -135,6 +135,21 @@ fallback display name) and `can_edit_metadata`. Older brokers may omit these.
135
135
  Older brokers may omit the count; the CLI reports it as null and never infers
136
136
  an empty account from an empty filtered list.
137
137
 
138
+ Subscription inventory (2026-11-04) adds optional `tier_name`, `is_free`, and
139
+ `free_expires_at` fields. Null values mean no subscription information or no
140
+ free expiration deadline, as applicable. The CLI displays the tier and free
141
+ deadline and starts warning seven days before free access expires, including
142
+ an expired warning at or after the deadline. JSON `servers_list` events include
143
+ the subscription fields and a `warnings` array with server ID, warning code,
144
+ deadline, and message. Warnings are evaluated when inventory is displayed;
145
+ there is no background polling.
146
+
147
+ `include_subscription=1` preserves compatibility with older clients whose list
148
+ validators reject extra fields. This compatibility opt-in can be retired when
149
+ support for those clients ends. This CLI accepts older responses without the
150
+ subscription fields and ignores unknown inventory and server-entry fields,
151
+ while continuing to validate every recognized field it consumes.
152
+
138
153
  The `servers_list` event adds `workspace_count` and `discovery_state`:
139
154
  `no_workspaces` only for a verified count of zero, `ready` when any listed
140
155
  workspace is pairing-ready, `not_ready` when workspaces exist but none is ready,
@@ -187,7 +202,7 @@ npx teamclaws pair status <server-identifier-or-canonical-workspace-address>
187
202
  npx teamclaws pair
188
203
  npx teamclaws pair <server-identifier-or-canonical-workspace-address> [--no-open]
189
204
  npx teamclaws shell <target> --command <text> [--json]
190
- npx teamclaws users add <target> <email> --role <user|staff|superuser> [--json]
205
+ npx teamclaws users add <target> <email> --role <user|staff|superuser> [--sudo] [--json]
191
206
  npx teamclaws chat start <target> --message <text>
192
207
  npx teamclaws chat send <target> --session-id <uuid> --message <text>
193
208
  npx teamclaws chat watch <target> --session-id <uuid> --request-id <uuid>
@@ -245,6 +260,19 @@ acceptance. Existing memberships and pending invitations are preserved without
245
260
  promotion or resend. If a request has an uncertain network outcome, inspect the
246
261
  invitation status before trying again; the command does not blindly retry it.
247
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
+
248
276
  ### Inspect users and invitation status
249
277
 
250
278
  ```text
@@ -257,6 +285,9 @@ records. An accepted invitation is historical evidence of acceptance; current
257
285
  membership determines whether the person still has access. An expired pending
258
286
  invitation is marked expired. Listing sends no invitations and changes no roles,
259
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.
260
291
 
261
292
  ## Read chat history without a browser
262
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/broker.js CHANGED
@@ -17,7 +17,7 @@ export class BrokerClient {
17
17
  return normalizedDeviceName(this.deviceName());
18
18
  }
19
19
  async servers(signal) {
20
- const url = `${API_BASE}servers/?include_inventory=1&include_description=1&include_editable_metadata=1`;
20
+ const url = `${API_BASE}servers/?include_inventory=1&include_description=1&include_editable_metadata=1&include_subscription=1`;
21
21
  const response = await requestJson(this.fetcher, url, {
22
22
  headers: await this.issuerHeaders("GET", url),
23
23
  ...(signal ? { signal } : {}),
package/dist/constants.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export const PACKAGE_NAME = "teamclaws";
2
- export const PACKAGE_VERSION = "2.0.9";
2
+ export const PACKAGE_VERSION = "2.0.11";
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
@@ -84,11 +84,33 @@ export class Output {
84
84
  }
85
85
  }
86
86
  servers(servers, workspaceCount) {
87
+ const now = Date.now();
88
+ const warnings = servers.flatMap((server) => {
89
+ if (server.is_free !== true || !server.free_expires_at)
90
+ return [];
91
+ const remaining = Date.parse(server.free_expires_at) - now;
92
+ if (remaining > 7 * 24 * 60 * 60 * 1_000)
93
+ return [];
94
+ const expired = remaining <= 0;
95
+ return [
96
+ {
97
+ server_id: server.server_id,
98
+ code: expired
99
+ ? "free_subscription_expired"
100
+ : "free_subscription_expiring",
101
+ free_expires_at: server.free_expires_at,
102
+ message: expired
103
+ ? `Free access for ${server.alias} expired on ${server.free_expires_at}.`
104
+ : `Free access for ${server.alias} expires on ${server.free_expires_at} (within 7 days).`,
105
+ },
106
+ ];
107
+ });
87
108
  this.event({
88
109
  schema_version: OUTPUT_SCHEMA_VERSION,
89
110
  event: "servers_list",
90
111
  status: "success",
91
112
  servers,
113
+ warnings,
92
114
  workspace_count: workspaceCount ?? null,
93
115
  discovery_state: workspaceCount === 0
94
116
  ? "no_workspaces"
@@ -109,6 +131,14 @@ export class Output {
109
131
  this.stdout.write(`${index + 1}. ${server.alias} — ${server.server_id} — ${server.workspace_url} — ${server.pairing_ready ? "ready to pair" : "not ready to pair"}\n`);
110
132
  if (server.description)
111
133
  this.stdout.write(` ${server.description}\n`);
134
+ if (server.tier_name)
135
+ this.stdout.write(` Tier: ${server.tier_name}\n`);
136
+ if (server.is_free === true) {
137
+ this.stdout.write(` Free access${server.free_expires_at ? `; expires ${server.free_expires_at}` : ""}\n`);
138
+ }
139
+ const warning = warnings.find((item) => item.server_id === server.server_id);
140
+ if (warning)
141
+ this.stdout.write(` Warning: ${warning.message}\n`);
112
142
  });
113
143
  }
114
144
  }
@@ -397,7 +427,7 @@ export class Output {
397
427
  });
398
428
  if (!this.json) {
399
429
  const messages = {
400
- 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.`,
401
431
  already_pending: "An invitation is already pending; it was not resent.",
402
432
  already_member: "Already a member; access unchanged.",
403
433
  already_owner: "Already the owner; access unchanged.",
@@ -414,12 +444,12 @@ export class Output {
414
444
  if (!this.json) {
415
445
  this.stdout.write("Current members:\n");
416
446
  for (const member of result.members)
417
- 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`);
418
448
  if (!result.members.length)
419
449
  this.stdout.write("No members returned.\n");
420
450
  this.stdout.write("Invitations:\n");
421
451
  for (const invite of result.invites)
422
- 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`);
423
453
  if (!result.invites.length)
424
454
  this.stdout.write("No pending or accepted invitations.\n");
425
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
  }
@@ -342,7 +342,6 @@ export function parseServersResponse(value) {
342
342
  exitCode: 9,
343
343
  });
344
344
  }
345
- assertExactKeys(value, ["servers"], ["workspace_count"], "server list");
346
345
  if (!Array.isArray(value.servers)) {
347
346
  throw new TeamClawsError("invalid_response", "TeamClaws returned an invalid server list.", {
348
347
  exitCode: 9,
@@ -359,7 +358,6 @@ export function parseServersResponse(value) {
359
358
  exitCode: 9,
360
359
  });
361
360
  }
362
- assertExactKeys(server, ["id", "alias", "workspace_url", "status", "pairing_ready"], ["description", "custom_alias", "can_edit_metadata"], "server");
363
361
  if (typeof server.pairing_ready !== "boolean") {
364
362
  throw new TeamClawsError("invalid_response", "TeamClaws returned an invalid server.", {
365
363
  exitCode: 9,
@@ -376,8 +374,28 @@ export function parseServersResponse(value) {
376
374
  typeof server.can_edit_metadata !== "boolean")) {
377
375
  throw new TeamClawsError("invalid_response", "TeamClaws returned invalid server editing permissions.", { exitCode: 9 });
378
376
  }
377
+ if (server.is_free !== undefined &&
378
+ server.is_free !== null &&
379
+ typeof server.is_free !== "boolean") {
380
+ throw new TeamClawsError("invalid_response", "TeamClaws returned an invalid free subscription status.", { exitCode: 9 });
381
+ }
379
382
  return {
380
383
  server_id: normalizeUuid(server.id),
384
+ ...(server.tier_name !== undefined
385
+ ? {
386
+ tier_name: server.tier_name === null
387
+ ? null
388
+ : requireString(server.tier_name, "subscription tier", 200),
389
+ }
390
+ : {}),
391
+ ...(server.is_free !== undefined ? { is_free: server.is_free } : {}),
392
+ ...(server.free_expires_at !== undefined
393
+ ? {
394
+ free_expires_at: server.free_expires_at === null
395
+ ? null
396
+ : requireIsoDate(server.free_expires_at, "free subscription expiry"),
397
+ }
398
+ : {}),
381
399
  alias: requireString(server.alias, "server alias", 200),
382
400
  ...(typeof server.description === "string"
383
401
  ? { description: server.description }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teamclaws",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
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",