teamclaws 2.0.19 → 2.0.21
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 +30 -2
- package/dist/app.js +74 -1
- package/dist/broker.js +148 -0
- package/dist/constants.js +1 -1
- package/dist/output.js +46 -3
- package/dist/storage.js +15 -2
- package/dist/users.js +1 -0
- package/package.json +1 -1
- package/skills/teamclaws-project/SKILL.md +8 -0
package/README.md
CHANGED
|
@@ -243,6 +243,9 @@ a short-lived target proof for that bound pairing, performs at most one direct
|
|
|
243
243
|
workspace verification with a five-second timeout, reports the result, and
|
|
244
244
|
stops. It never starts pairing or loads external-chat resources.
|
|
245
245
|
|
|
246
|
+
Legacy saved pairings for other workspaces do not require the selected workspace
|
|
247
|
+
to be paired again.
|
|
248
|
+
|
|
246
249
|
After pairing, `chat start`, `chat send`, and `chat watch` use the protected
|
|
247
250
|
workspace credential directly against that exact workspace. They verify the
|
|
248
251
|
authoritative versioned handoff, resolve the workspace capability catalog, and
|
|
@@ -270,8 +273,8 @@ acceptance. Existing memberships and pending invitations are preserved without
|
|
|
270
273
|
promotion or resend. If a request has an uncertain network outcome, inspect the
|
|
271
274
|
invitation status before trying again; the command does not blindly retry it.
|
|
272
275
|
|
|
273
|
-
The owner can include `--sudo` when inviting a `superuser` to grant full
|
|
274
|
-
access
|
|
276
|
+
The owner can include `--sudo` when inviting a `superuser` to grant full server access after acceptance, covering every workspace server included in the invitation.
|
|
277
|
+
This user and their agents can control those servers and access everything stored on them, including other users' saved passwords, API keys, and connected-account credentials. Only grant this to someone you trust with that access:
|
|
275
278
|
|
|
276
279
|
```text
|
|
277
280
|
teamclaws users add <target> <email> --sudo
|
|
@@ -312,6 +315,31 @@ When supplied by the workspace, each entry includes its saved `sudo_enabled`
|
|
|
312
315
|
status. An accepted invitation's selection is historical; the current member's
|
|
313
316
|
status determines their current access.
|
|
314
317
|
|
|
318
|
+
## Manage email access for a server
|
|
319
|
+
|
|
320
|
+
```sh
|
|
321
|
+
teamclaws email accounts
|
|
322
|
+
teamclaws email list <server-id>
|
|
323
|
+
teamclaws email set <server-id> google <account-id> --policy read_only
|
|
324
|
+
teamclaws email set <server-id> microsoft <account-id> --policy write_with_approval_read
|
|
325
|
+
teamclaws email remove <server-id> google <account-id>
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
Owners can assign or remove their connected Google and Microsoft accounts on their servers. Find IDs with `servers list` and `email accounts`. Connect a missing account at [Connected Email](https://www.teamclaws.com/app/connected-email/).
|
|
329
|
+
|
|
330
|
+
Choose `read_only`, `write_with_approval_read`, or `write_read`. The command prints the effective saved policy. Read-only account credentials restrict the saved policy to `read_only`. Removal also succeeds when the account is already unassigned. Check `email list` after an uncertain mutation before retrying.
|
|
331
|
+
|
|
332
|
+
`servers list` shows assigned email and X accounts. Each assigned X account appears by its handle. These email commands and the commands below support `--json`.
|
|
333
|
+
|
|
334
|
+
## Submit a bug report or feedback
|
|
335
|
+
|
|
336
|
+
```sh
|
|
337
|
+
teamclaws bug report --title "Short summary" --body "What happened and how to reproduce it"
|
|
338
|
+
teamclaws feedback send --title "Short summary" --body "Your suggestion"
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
These explicit submissions use the same intake as the site's corner feedback widget and return the submitted issue link. The shared limit is three submissions per day. Titles allow 255 characters and bodies allow 20,000 characters.
|
|
342
|
+
|
|
315
343
|
## Manage GitHub repository permissions for a server
|
|
316
344
|
|
|
317
345
|
These commands manage server access to repositories you have already connected to TeamClaws.
|
package/dist/app.js
CHANGED
|
@@ -173,6 +173,19 @@ export async function run(arguments_, dependencies = {}, signal) {
|
|
|
173
173
|
case "git_repos":
|
|
174
174
|
output.gitRepositories(await broker.gitRepositories(signal));
|
|
175
175
|
return 0;
|
|
176
|
+
case "email_accounts":
|
|
177
|
+
output.emailAccounts(await broker.emailAccounts(signal));
|
|
178
|
+
return 0;
|
|
179
|
+
case "email_list":
|
|
180
|
+
output.emailAssignments(await broker.emailAssignments(parsed.serverId, signal));
|
|
181
|
+
return 0;
|
|
182
|
+
case "email_set":
|
|
183
|
+
case "email_remove":
|
|
184
|
+
output.emailAssignmentResult(await broker.changeEmailAssignment(parsed.serverId, parsed.provider, parsed.accountId, parsed.action === "email_set" ? parsed.policy : undefined, signal));
|
|
185
|
+
return 0;
|
|
186
|
+
case "feedback":
|
|
187
|
+
output.feedbackResult(await broker.submitFeedback(parsed.label, parsed.title, parsed.body, signal));
|
|
188
|
+
return 0;
|
|
176
189
|
case "git_list":
|
|
177
190
|
output.gitAssignments(await broker.gitAssignments(parsed.serverId, signal));
|
|
178
191
|
return 0;
|
|
@@ -217,6 +230,66 @@ export async function run(arguments_, dependencies = {}, signal) {
|
|
|
217
230
|
}
|
|
218
231
|
}
|
|
219
232
|
export function parseArguments(arguments_) {
|
|
233
|
+
if (arguments_[0] === "email") {
|
|
234
|
+
const operation = arguments_[1];
|
|
235
|
+
if (operation === "accounts") {
|
|
236
|
+
const { flags } = parseNamedOptions(arguments_.slice(2), {
|
|
237
|
+
values: [],
|
|
238
|
+
booleans: ["--json"],
|
|
239
|
+
});
|
|
240
|
+
return { action: "email_accounts", json: flags.has("--json") };
|
|
241
|
+
}
|
|
242
|
+
const serverId = normalizeUuid(requiredPositional(arguments_, 2));
|
|
243
|
+
if (operation === "list") {
|
|
244
|
+
const { flags } = parseNamedOptions(arguments_.slice(3), {
|
|
245
|
+
values: [],
|
|
246
|
+
booleans: ["--json"],
|
|
247
|
+
});
|
|
248
|
+
return { action: "email_list", serverId, json: flags.has("--json") };
|
|
249
|
+
}
|
|
250
|
+
if (operation !== "set" && operation !== "remove")
|
|
251
|
+
throw usageError();
|
|
252
|
+
const provider = requiredPositional(arguments_, 3);
|
|
253
|
+
if (provider !== "google" && provider !== "microsoft")
|
|
254
|
+
throw usageError();
|
|
255
|
+
const rawId = requiredPositional(arguments_, 4);
|
|
256
|
+
const accountId = Number(rawId);
|
|
257
|
+
if (!/^[1-9][0-9]*$/.test(rawId) || !Number.isSafeInteger(accountId))
|
|
258
|
+
throw usageError();
|
|
259
|
+
const { values, flags } = parseNamedOptions(arguments_.slice(5), {
|
|
260
|
+
values: operation === "set" ? ["--policy"] : [],
|
|
261
|
+
booleans: ["--json"],
|
|
262
|
+
});
|
|
263
|
+
const json = flags.has("--json");
|
|
264
|
+
if (operation === "remove")
|
|
265
|
+
return { action: "email_remove", serverId, provider, accountId, json };
|
|
266
|
+
const policy = values["--policy"];
|
|
267
|
+
if (policy !== "read_only" &&
|
|
268
|
+
policy !== "write_with_approval_read" &&
|
|
269
|
+
policy !== "write_read")
|
|
270
|
+
throw usageError();
|
|
271
|
+
return { action: "email_set", serverId, provider, accountId, policy, json };
|
|
272
|
+
}
|
|
273
|
+
if (arguments_[0] === "bug" || arguments_[0] === "feedback") {
|
|
274
|
+
const bug = arguments_[0] === "bug";
|
|
275
|
+
if (arguments_[1] !== (bug ? "report" : "send"))
|
|
276
|
+
throw usageError();
|
|
277
|
+
const { values, flags } = parseNamedOptions(arguments_.slice(2), {
|
|
278
|
+
values: ["--title", "--body"],
|
|
279
|
+
booleans: ["--json"],
|
|
280
|
+
});
|
|
281
|
+
const title = values["--title"]?.trim();
|
|
282
|
+
const body = values["--body"]?.trim();
|
|
283
|
+
if (!title || !body || [...title].length > 255 || [...body].length > 20000)
|
|
284
|
+
throw usageError();
|
|
285
|
+
return {
|
|
286
|
+
action: "feedback",
|
|
287
|
+
label: bug ? "bug" : "enhancement",
|
|
288
|
+
title,
|
|
289
|
+
body,
|
|
290
|
+
json: flags.has("--json"),
|
|
291
|
+
};
|
|
292
|
+
}
|
|
220
293
|
if (arguments_[0] === "git") {
|
|
221
294
|
const operation = arguments_[1];
|
|
222
295
|
if (operation === "repos") {
|
|
@@ -633,5 +706,5 @@ function usageError() {
|
|
|
633
706
|
});
|
|
634
707
|
}
|
|
635
708
|
export function helpText() {
|
|
636
|
-
return `TeamClaws ${PACKAGE_VERSION}\n\nUsage:\n teamclaws update [--json]\n teamclaws shell <target> --command <text> [--json]\n teamclaws users add <target> <email> [--sudo] [--json]\n teamclaws users remove <target> <email> [--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 git repos [--json]\n teamclaws git list <server-id> [--json]\n teamclaws git set <server-id> <repository-id> --issues <none|read|write> --contents <none|read|write> --pull-requests <none|read|write> --workflows <none|write> [--json]\n teamclaws git remove <server-id> <repository-id> [--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`;
|
|
709
|
+
return `TeamClaws ${PACKAGE_VERSION}\n\nUsage:\n teamclaws update [--json]\n teamclaws shell <target> --command <text> [--json]\n teamclaws users add <target> <email> [--sudo] [--json]\n teamclaws users remove <target> <email> [--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 email accounts [--json]\n teamclaws email list <server-id> [--json]\n teamclaws email set <server-id> <google|microsoft> <account-id> --policy <read_only|write_with_approval_read|write_read> [--json]\n teamclaws email remove <server-id> <google|microsoft> <account-id> [--json]\n teamclaws bug report --title <text> --body <text> [--json]\n teamclaws feedback send --title <text> --body <text> [--json]\n teamclaws git repos [--json]\n teamclaws git list <server-id> [--json]\n teamclaws git set <server-id> <repository-id> --issues <none|read|write> --contents <none|read|write> --pull-requests <none|read|write> --workflows <none|write> [--json]\n teamclaws git remove <server-id> <repository-id> [--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`;
|
|
637
710
|
}
|
package/dist/broker.js
CHANGED
|
@@ -5,6 +5,7 @@ import { TeamClawsError } from "./errors.js";
|
|
|
5
5
|
import { errorFromResponse, requestJson } from "./http.js";
|
|
6
6
|
import { assertExactKeys, isObject, normalizeUuid, parsePendingPairing, parseWorkspaceInventory, requireInteger, requireString, } from "./validation.js";
|
|
7
7
|
const CONNECTED_GITHUB_URL = "https://www.teamclaws.com/app/connected-github/";
|
|
8
|
+
const CONNECTED_EMAIL_URL = "https://www.teamclaws.com/app/connected-email/";
|
|
8
9
|
const GIT_PERMISSION_KEYS = [
|
|
9
10
|
"issues",
|
|
10
11
|
"contents",
|
|
@@ -77,6 +78,132 @@ export class BrokerClient {
|
|
|
77
78
|
connect_url: body.connect_url,
|
|
78
79
|
};
|
|
79
80
|
}
|
|
81
|
+
async emailAccounts(signal) {
|
|
82
|
+
const body = await this.emailRequest("GET", `${API_BASE}email-accounts/`, undefined, signal);
|
|
83
|
+
if (!Array.isArray(body.accounts) ||
|
|
84
|
+
body.connect_url !== CONNECTED_EMAIL_URL)
|
|
85
|
+
throw invalidEmailResponse();
|
|
86
|
+
return {
|
|
87
|
+
accounts: body.accounts.map((row) => {
|
|
88
|
+
if (!isObject(row) ||
|
|
89
|
+
(row.permission_level !== "read_only" &&
|
|
90
|
+
row.permission_level !== "read_write"))
|
|
91
|
+
throw invalidEmailResponse();
|
|
92
|
+
return { ...emailAccount(row), permission_level: row.permission_level };
|
|
93
|
+
}),
|
|
94
|
+
connect_url: CONNECTED_EMAIL_URL,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async emailAssignments(serverId, signal) {
|
|
98
|
+
const id = normalizeUuid(serverId);
|
|
99
|
+
const body = await this.emailRequest("GET", `${API_BASE}servers/${id}/email-accounts/`, undefined, signal);
|
|
100
|
+
if (body.server_id !== id || !Array.isArray(body.accounts))
|
|
101
|
+
throw invalidEmailResponse();
|
|
102
|
+
return {
|
|
103
|
+
server_id: id,
|
|
104
|
+
accounts: body.accounts.map((row) => {
|
|
105
|
+
if (!isObject(row))
|
|
106
|
+
throw invalidEmailResponse();
|
|
107
|
+
return {
|
|
108
|
+
...emailAccount(row),
|
|
109
|
+
assignment_policy: emailPolicy(row.assignment_policy),
|
|
110
|
+
};
|
|
111
|
+
}),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
async changeEmailAssignment(serverId, provider, accountId, policy, signal) {
|
|
115
|
+
const id = normalizeUuid(serverId);
|
|
116
|
+
const body = await this.emailRequest(policy ? "POST" : "DELETE", `${API_BASE}servers/${id}/email-accounts/${provider}/${accountId}/`, policy ? { assignment_policy: policy } : undefined, signal);
|
|
117
|
+
const account = emailAccount(body);
|
|
118
|
+
if (body.server_id !== id ||
|
|
119
|
+
account.provider !== provider ||
|
|
120
|
+
account.account_id !== accountId)
|
|
121
|
+
throw invalidEmailResponse();
|
|
122
|
+
const code = body.code;
|
|
123
|
+
if (policy) {
|
|
124
|
+
const effective = emailPolicy(body.assignment_policy);
|
|
125
|
+
if (code !== "permissions_set" ||
|
|
126
|
+
(effective !== policy && effective !== "read_only"))
|
|
127
|
+
throw invalidEmailResponse();
|
|
128
|
+
return { ...account, server_id: id, code, assignment_policy: effective };
|
|
129
|
+
}
|
|
130
|
+
if ((code !== "removed" && code !== "already_unassigned") ||
|
|
131
|
+
body.assignment_policy !== null)
|
|
132
|
+
throw invalidEmailResponse();
|
|
133
|
+
return { ...account, server_id: id, code, assignment_policy: null };
|
|
134
|
+
}
|
|
135
|
+
async emailRequest(method, url, body, signal) {
|
|
136
|
+
const response = await requestJson(this.fetcher, url, {
|
|
137
|
+
method,
|
|
138
|
+
headers: await this.issuerHeaders(method, url),
|
|
139
|
+
...(body ? { body } : {}),
|
|
140
|
+
...(signal ? { signal } : {}),
|
|
141
|
+
});
|
|
142
|
+
if (response.status !== 200) {
|
|
143
|
+
const error = errorFromResponse(response, "email_permissions_failed");
|
|
144
|
+
if (error.code === "account_unavailable" &&
|
|
145
|
+
isObject(response.body) &&
|
|
146
|
+
isObject(response.body.error) &&
|
|
147
|
+
response.body.error.connect_url === CONNECTED_EMAIL_URL)
|
|
148
|
+
throw new TeamClawsError(error.code, error.message, {
|
|
149
|
+
exitCode: error.exitCode,
|
|
150
|
+
connectUrl: CONNECTED_EMAIL_URL,
|
|
151
|
+
});
|
|
152
|
+
throw error;
|
|
153
|
+
}
|
|
154
|
+
if (!isObject(response.body))
|
|
155
|
+
throw invalidEmailResponse();
|
|
156
|
+
return response.body;
|
|
157
|
+
}
|
|
158
|
+
async submitFeedback(label, title, body, signal) {
|
|
159
|
+
const url = `${API_BASE}feedback/`;
|
|
160
|
+
const response = await requestJson(this.fetcher, url, {
|
|
161
|
+
method: "POST",
|
|
162
|
+
headers: await this.issuerHeaders("POST", url),
|
|
163
|
+
body: { label, title, body },
|
|
164
|
+
...(signal ? { signal } : {}),
|
|
165
|
+
});
|
|
166
|
+
if (response.status < 200 || response.status >= 300) {
|
|
167
|
+
const error = errorFromResponse(response, "feedback_failed");
|
|
168
|
+
const errorBody = isObject(response.body) ? response.body : {};
|
|
169
|
+
const detail = errorBody.detail;
|
|
170
|
+
const fieldErrors = ["title", "body", "non_field_errors"]
|
|
171
|
+
.flatMap((field) => {
|
|
172
|
+
const messages = errorBody[field];
|
|
173
|
+
return Array.isArray(messages)
|
|
174
|
+
? messages
|
|
175
|
+
.filter((message) => typeof message === "string")
|
|
176
|
+
.map((message) => `${field}: ${message}`)
|
|
177
|
+
: [];
|
|
178
|
+
})
|
|
179
|
+
.join(" ");
|
|
180
|
+
throw new TeamClawsError(error.code, typeof detail === "string" ? detail : fieldErrors || error.message, { exitCode: error.exitCode });
|
|
181
|
+
}
|
|
182
|
+
const result = response.body;
|
|
183
|
+
if (!isObject(result) ||
|
|
184
|
+
result.source !== "cli" ||
|
|
185
|
+
result.label !== label ||
|
|
186
|
+
result.title !== title ||
|
|
187
|
+
result.status !== "submitted" ||
|
|
188
|
+
!Number.isSafeInteger(result.github_issue_number) ||
|
|
189
|
+
Number(result.github_issue_number) <= 0 ||
|
|
190
|
+
!Number.isSafeInteger(result.remaining_today) ||
|
|
191
|
+
Number(result.remaining_today) < 0)
|
|
192
|
+
throw new TeamClawsError("invalid_response", "TeamClaws returned an invalid feedback receipt.", { exitCode: 9 });
|
|
193
|
+
const issueUrl = requireString(result.github_issue_url, "feedback issue URL", 2048);
|
|
194
|
+
if (!issueUrl.startsWith("https://github.com/"))
|
|
195
|
+
throw new TeamClawsError("invalid_response", "TeamClaws returned an invalid feedback issue URL.", { exitCode: 9 });
|
|
196
|
+
return {
|
|
197
|
+
id: normalizeUuid(result.id),
|
|
198
|
+
source: "cli",
|
|
199
|
+
label,
|
|
200
|
+
title,
|
|
201
|
+
status: "submitted",
|
|
202
|
+
github_issue_number: Number(result.github_issue_number),
|
|
203
|
+
github_issue_url: issueUrl,
|
|
204
|
+
remaining_today: Number(result.remaining_today),
|
|
205
|
+
};
|
|
206
|
+
}
|
|
80
207
|
async gitAssignments(serverId, signal) {
|
|
81
208
|
const id = normalizeUuid(serverId);
|
|
82
209
|
const body = await this.gitRequest("GET", `${API_BASE}servers/${id}/github-repositories/`, signal);
|
|
@@ -236,6 +363,27 @@ function gitPermissions(value) {
|
|
|
236
363
|
workflows,
|
|
237
364
|
};
|
|
238
365
|
}
|
|
366
|
+
function invalidEmailResponse() {
|
|
367
|
+
return new TeamClawsError("invalid_response", "TeamClaws returned an invalid email permissions response.", { exitCode: 9 });
|
|
368
|
+
}
|
|
369
|
+
function emailAccount(row) {
|
|
370
|
+
if ((row.provider !== "google" && row.provider !== "microsoft") ||
|
|
371
|
+
!Number.isSafeInteger(row.account_id) ||
|
|
372
|
+
Number(row.account_id) <= 0)
|
|
373
|
+
throw invalidEmailResponse();
|
|
374
|
+
return {
|
|
375
|
+
provider: row.provider,
|
|
376
|
+
account_id: Number(row.account_id),
|
|
377
|
+
email: requireString(row.email, "email account", 254),
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
function emailPolicy(value) {
|
|
381
|
+
if (value !== "read_only" &&
|
|
382
|
+
value !== "write_with_approval_read" &&
|
|
383
|
+
value !== "write_read")
|
|
384
|
+
throw invalidEmailResponse();
|
|
385
|
+
return value;
|
|
386
|
+
}
|
|
239
387
|
function invalidMetadataResponse() {
|
|
240
388
|
return new TeamClawsError("invalid_response", "TeamClaws returned invalid server metadata.", { exitCode: 9 });
|
|
241
389
|
}
|
package/dist/constants.js
CHANGED
package/dist/output.js
CHANGED
|
@@ -429,6 +429,49 @@ export class Output {
|
|
|
429
429
|
this.stdout.write(`${repo.repository_id} ${repo.full_name}\n`);
|
|
430
430
|
this.stdout.write(`Missing a repository? Go to ${result.connect_url} to add or enable it.\n`);
|
|
431
431
|
}
|
|
432
|
+
emailAccounts(result) {
|
|
433
|
+
this.event({
|
|
434
|
+
schema_version: OUTPUT_SCHEMA_VERSION,
|
|
435
|
+
event: "email_accounts",
|
|
436
|
+
...result,
|
|
437
|
+
});
|
|
438
|
+
if (this.json)
|
|
439
|
+
return;
|
|
440
|
+
for (const account of result.accounts)
|
|
441
|
+
this.stdout.write(`${account.provider} ${account.account_id} ${account.email} ${account.permission_level}\n`);
|
|
442
|
+
this.stdout.write(`${result.accounts.length ? "Missing an account?" : "You don't have any email accounts connected."} Go to ${result.connect_url} to connect one.\n`);
|
|
443
|
+
}
|
|
444
|
+
emailAssignments(result) {
|
|
445
|
+
this.event({
|
|
446
|
+
schema_version: OUTPUT_SCHEMA_VERSION,
|
|
447
|
+
event: "email_assignments",
|
|
448
|
+
...result,
|
|
449
|
+
});
|
|
450
|
+
if (this.json)
|
|
451
|
+
return;
|
|
452
|
+
if (!result.accounts.length)
|
|
453
|
+
this.stdout.write(`No email accounts assigned to ${result.server_id}.\n`);
|
|
454
|
+
for (const account of result.accounts)
|
|
455
|
+
this.stdout.write(`${account.provider} ${account.account_id} ${account.email} ${account.assignment_policy}\n`);
|
|
456
|
+
}
|
|
457
|
+
emailAssignmentResult(result) {
|
|
458
|
+
this.event({
|
|
459
|
+
schema_version: OUTPUT_SCHEMA_VERSION,
|
|
460
|
+
event: "email_assignment_result",
|
|
461
|
+
...result,
|
|
462
|
+
});
|
|
463
|
+
if (!this.json)
|
|
464
|
+
this.stdout.write(`${result.email} (${result.provider} ${result.account_id}) on ${result.server_id}: ${result.assignment_policy ?? result.code}\n`);
|
|
465
|
+
}
|
|
466
|
+
feedbackResult(result) {
|
|
467
|
+
this.event({
|
|
468
|
+
schema_version: OUTPUT_SCHEMA_VERSION,
|
|
469
|
+
event: "feedback_result",
|
|
470
|
+
...result,
|
|
471
|
+
});
|
|
472
|
+
if (!this.json)
|
|
473
|
+
this.stdout.write(`Submitted ${result.label === "bug" ? "bug report" : "feedback"}: ${result.github_issue_url}\n`);
|
|
474
|
+
}
|
|
432
475
|
gitAssignments(result) {
|
|
433
476
|
this.event({
|
|
434
477
|
schema_version: OUTPUT_SCHEMA_VERSION,
|
|
@@ -487,7 +530,7 @@ export class Output {
|
|
|
487
530
|
});
|
|
488
531
|
if (!this.json) {
|
|
489
532
|
const messages = {
|
|
490
|
-
invited: `Invitation sent for ${result.requested_role} access${result.sudo_enabled === true ? " with
|
|
533
|
+
invited: `Invitation sent for ${result.requested_role} access${result.sudo_enabled === true ? " with full server access" : result.sudo_enabled === false ? " without full server access" : ""}. Access begins after acceptance.`,
|
|
491
534
|
already_pending: "An invitation is already pending; it was not resent.",
|
|
492
535
|
already_member: "Already a member; access unchanged.",
|
|
493
536
|
already_owner: "Already the owner; access unchanged.",
|
|
@@ -515,12 +558,12 @@ export class Output {
|
|
|
515
558
|
if (!this.json) {
|
|
516
559
|
this.stdout.write("Current members:\n");
|
|
517
560
|
for (const member of result.members)
|
|
518
|
-
this.stdout.write(`${member.email}: ${member.role}${member.is_owner ? " (owner)" : ""}${member.sudo_enabled === true ? " —
|
|
561
|
+
this.stdout.write(`${member.email}: ${member.role}${member.is_owner ? " (owner)" : ""}${member.sudo_enabled === true ? " — full server access enabled" : member.sudo_enabled === false ? " — full server access disabled" : ""}\n`);
|
|
519
562
|
if (!result.members.length)
|
|
520
563
|
this.stdout.write("No members returned.\n");
|
|
521
564
|
this.stdout.write("Invitations:\n");
|
|
522
565
|
for (const invite of result.invites)
|
|
523
|
-
this.stdout.write(`${invite.email}: ${invite.status}${invite.is_expired && invite.status === "pending" ? " (expired)" : ""} — ${invite.role}${invite.sudo_enabled === true ? " —
|
|
566
|
+
this.stdout.write(`${invite.email}: ${invite.status}${invite.is_expired && invite.status === "pending" ? " (expired)" : ""} — ${invite.role}${invite.sudo_enabled === true ? " — full server access enabled" : invite.sudo_enabled === false ? " — full server access disabled" : ""}\n`);
|
|
524
567
|
if (!result.invites.length)
|
|
525
568
|
this.stdout.write("No pending or accepted invitations.\n");
|
|
526
569
|
}
|
package/dist/storage.js
CHANGED
|
@@ -6,7 +6,7 @@ import { basename, dirname, join } from "node:path";
|
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import { TeamClawsError } from "./errors.js";
|
|
8
8
|
import { parseDurableAuthorization, } from "./target-authorization.js";
|
|
9
|
-
import { isObject, requireHttpsUrl, requireInteger, normalizeUuid, parseLoginCredential, parseStatusWorkspaceCredential, parseWorkspaceCredential, } from "./validation.js";
|
|
9
|
+
import { canonicalWorkspaceOrigin, isObject, requireHttpsUrl, requireInteger, normalizeUuid, parseLoginCredential, parseStatusWorkspaceCredential, parseWorkspaceCredential, } from "./validation.js";
|
|
10
10
|
const execFile = promisify(execFileCallback);
|
|
11
11
|
const SYSTEM_SID = "S-1-5-18";
|
|
12
12
|
const MAX_WORKSPACE_CREDENTIAL_FILES = 256;
|
|
@@ -86,7 +86,20 @@ export class CredentialStore {
|
|
|
86
86
|
for (const name of names.sort()) {
|
|
87
87
|
if (!UUID_CREDENTIAL_NAME.test(name))
|
|
88
88
|
continue;
|
|
89
|
-
const
|
|
89
|
+
const serverId = name.slice(0, -5);
|
|
90
|
+
const value = await this.readJsonIfPresent(this.workspacePath(serverId));
|
|
91
|
+
if (isObject(value) && value.version === 1) {
|
|
92
|
+
try {
|
|
93
|
+
if (canonicalWorkspaceOrigin(value.origin) !== origin)
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
// Preserve the legacy error below when its origin cannot be identified.
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const credential = value === undefined
|
|
101
|
+
? undefined
|
|
102
|
+
: parseStatusWorkspaceCredential(value, serverId);
|
|
90
103
|
if (credential?.origin === origin)
|
|
91
104
|
matches.push(credential);
|
|
92
105
|
}
|
package/dist/users.js
CHANGED
|
@@ -19,6 +19,7 @@ const failureMessages = {
|
|
|
19
19
|
sudo_requires_superuser: "Sudo access can only accompany superuser access.",
|
|
20
20
|
invalid_request: "The workspace rejected the add-user request.",
|
|
21
21
|
invite_delivery_failed: "The invitation could not be delivered. Check its status before retrying.",
|
|
22
|
+
invitation_rate_limited: "This workspace has reached its invitation email limit. Try again later.",
|
|
22
23
|
outcome_unverified: "The invitation outcome could not be verified. Check its status before retrying.",
|
|
23
24
|
};
|
|
24
25
|
export async function runUsersList(store, fetcher, target, authorization, signal) {
|
package/package.json
CHANGED
|
@@ -23,6 +23,14 @@ access, and account permissions through the paired shell before choosing a setup
|
|
|
23
23
|
Pairing connects this computer to the workspace. It does not add a person as a
|
|
24
24
|
workspace user; user membership is a separate privilege.
|
|
25
25
|
|
|
26
|
+
Full server access is optional and separate from the Admin role.
|
|
27
|
+
For agents, this grants sudo/root-equivalent access; keep this capability available.
|
|
28
|
+
Use `teamclaws users add <target> <email> --sudo --json` only when the owner explicitly authorizes that grant; Admin alone does not authorize it.
|
|
29
|
+
When the owner is choosing, explain: "This user and their agents can control every workspace server covered by this invitation and access everything stored on them, including other users' saved passwords, API keys, and connected-account credentials. Only grant this to someone you trust with that access."
|
|
30
|
+
Offer "Grant full server access" or "Keep standard Admin access"; omit `--sudo` for standard Admin access.
|
|
31
|
+
Use non-technical wording in the user-facing ask; do not say sudo or root unless the user expresses a preference for technical detail.
|
|
32
|
+
Respect an already explicit choice; do not add another confirmation step.
|
|
33
|
+
|
|
26
34
|
## Jobs, services, and external systems
|
|
27
35
|
|
|
28
36
|
For a complete job, place its code and authorized inputs in a dedicated directory,
|