teamclaws 2.0.22 → 2.0.23
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 +35 -0
- package/dist/app.js +45 -1
- package/dist/auth.js +112 -1
- package/dist/constants.js +1 -1
- package/dist/output.js +11 -0
- package/dist/storage.js +51 -0
- package/package.json +1 -1
- package/skills/teamclaws-login/SKILL.md +25 -0
- package/skills/teamclaws-onboard/SKILL.md +10 -0
package/README.md
CHANGED
|
@@ -42,6 +42,41 @@ GitHub source ZIPs must be built before use; they are not npm installers.
|
|
|
42
42
|
|
|
43
43
|
## Agent onboarding
|
|
44
44
|
|
|
45
|
+
### New accounts through email
|
|
46
|
+
|
|
47
|
+
For an authorized new-account signup, an agent with existing permission to read
|
|
48
|
+
the supplied mailbox can use:
|
|
49
|
+
|
|
50
|
+
```text
|
|
51
|
+
teamclaws signup <email> --json
|
|
52
|
+
teamclaws signup verify --code-stdin --json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The first command stores a private pending request and exits. `signup_pending`
|
|
56
|
+
means the request was accepted, not that an account was created or email delivered.
|
|
57
|
+
If eligible, the inbox receives a single-use code valid for 15 minutes. Supply
|
|
58
|
+
that code to the second command through the execution tool's non-TTY stdin,
|
|
59
|
+
ending with a newline. Never put it in command arguments, shell text, chat, or
|
|
60
|
+
logs. The CLI retains its separate secret and machine key; neither is emailed.
|
|
61
|
+
|
|
62
|
+
This also supports fresh email confirmation after access issued by this signup
|
|
63
|
+
flow was rejected. Only the backend can determine that narrow eligibility;
|
|
64
|
+
ordinary existing accounts still use browser login. Fresh confirmation creates
|
|
65
|
+
new authorization and never reactivates rejected access.
|
|
66
|
+
To reconfirm, start signup again after the denial and use its newly emailed code;
|
|
67
|
+
an earlier code or pending request cannot reconfirm access.
|
|
68
|
+
An active saved login
|
|
69
|
+
blocks signup; an authoritatively revoked login can be cleared by the normal
|
|
70
|
+
status check. Network failures preserve local state and stop.
|
|
71
|
+
|
|
72
|
+
Success uses the normal `login_complete` event and saved CLI authorization.
|
|
73
|
+
Then list workspaces and follow the user's explicit selection for existing
|
|
74
|
+
pairing. Signup does not read email, open a browser, buy a workspace, or pair one.
|
|
75
|
+
Do not automatically retry a rejected or uncertain exchange. If the account was
|
|
76
|
+
created but its successful response was lost, browser login is the recovery path.
|
|
77
|
+
|
|
78
|
+
### Existing account workflow
|
|
79
|
+
|
|
45
80
|
> Install teamclaws@latest, read its agent skills, and help me connect to my cloud workspace.
|
|
46
81
|
|
|
47
82
|
Installation and project transfer instructions: https://teamclaws.com/start.
|
package/dist/app.js
CHANGED
|
@@ -137,6 +137,12 @@ export async function run(arguments_, dependencies = {}, signal) {
|
|
|
137
137
|
});
|
|
138
138
|
try {
|
|
139
139
|
switch (parsed.action) {
|
|
140
|
+
case "signup":
|
|
141
|
+
await auth.signup(parsed.email, signal);
|
|
142
|
+
return 0;
|
|
143
|
+
case "signup_verify":
|
|
144
|
+
await auth.verifySignup(await readSignupCode(dependencies.io?.input ?? process.stdin, signal), signal);
|
|
145
|
+
return 0;
|
|
140
146
|
case "login":
|
|
141
147
|
await auth.login(parsed.email, signal);
|
|
142
148
|
return 0;
|
|
@@ -230,6 +236,23 @@ export async function run(arguments_, dependencies = {}, signal) {
|
|
|
230
236
|
}
|
|
231
237
|
}
|
|
232
238
|
export function parseArguments(arguments_) {
|
|
239
|
+
if (arguments_[0] === "signup") {
|
|
240
|
+
if (arguments_[1] === "verify") {
|
|
241
|
+
const { flags } = parseNamedOptions(arguments_.slice(2), {
|
|
242
|
+
values: [],
|
|
243
|
+
booleans: ["--code-stdin", "--json"],
|
|
244
|
+
});
|
|
245
|
+
if (!flags.has("--code-stdin"))
|
|
246
|
+
throw usageError();
|
|
247
|
+
return { action: "signup_verify", json: flags.has("--json") };
|
|
248
|
+
}
|
|
249
|
+
const email = requiredPositional(arguments_, 1);
|
|
250
|
+
const { flags } = parseNamedOptions(arguments_.slice(2), {
|
|
251
|
+
values: [],
|
|
252
|
+
booleans: ["--json"],
|
|
253
|
+
});
|
|
254
|
+
return { action: "signup", email, json: flags.has("--json") };
|
|
255
|
+
}
|
|
233
256
|
if (arguments_[0] === "email") {
|
|
234
257
|
const operation = arguments_[1];
|
|
235
258
|
if (operation === "accounts") {
|
|
@@ -700,11 +723,32 @@ async function promptForServer(servers, input, output) {
|
|
|
700
723
|
terminal.close();
|
|
701
724
|
}
|
|
702
725
|
}
|
|
726
|
+
async function readSignupCode(input, signal) {
|
|
727
|
+
if (input.isTTY)
|
|
728
|
+
throw new TeamClawsError("invalid_command", "Provide the signup code through non-TTY stdin; interactive input is not accepted.", { exitCode: 2 });
|
|
729
|
+
const reader = createInterface({
|
|
730
|
+
input,
|
|
731
|
+
terminal: false,
|
|
732
|
+
...(signal ? { signal } : {}),
|
|
733
|
+
});
|
|
734
|
+
try {
|
|
735
|
+
for await (const line of reader)
|
|
736
|
+
return line;
|
|
737
|
+
if (signal?.aborted)
|
|
738
|
+
throw new TeamClawsError("cancelled", "Signup was cancelled.", {
|
|
739
|
+
exitCode: 8,
|
|
740
|
+
});
|
|
741
|
+
return "";
|
|
742
|
+
}
|
|
743
|
+
finally {
|
|
744
|
+
reader.close();
|
|
745
|
+
}
|
|
746
|
+
}
|
|
703
747
|
function usageError() {
|
|
704
748
|
return new TeamClawsError("invalid_command", "Run `teamclaws --help` for supported commands.", {
|
|
705
749
|
exitCode: 2,
|
|
706
750
|
});
|
|
707
751
|
}
|
|
708
752
|
export function helpText() {
|
|
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`;
|
|
753
|
+
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 signup <email> [--json]\n teamclaws signup verify --code-stdin [--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`;
|
|
710
754
|
}
|
package/dist/auth.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
1
2
|
import { API_BASE, API_V2_BASE, API_RESOURCE, OAUTH_CLIENT_ID, OAUTH_DEVICE_AUTHORIZATION_URL, OAUTH_LOGIN_TIMEOUT_MS, OAUTH_TOKEN_URL, TEAMCLAWS_ORIGIN, } from "./constants.js";
|
|
2
3
|
import { TeamClawsError } from "./errors.js";
|
|
3
4
|
import { errorFromResponse, requestJson } from "./http.js";
|
|
4
|
-
import { assertExactKeys, isObject, parseSafeUserResponse, requireHttpsUrl, requireInteger, requireString, } from "./validation.js";
|
|
5
|
+
import { assertExactKeys, isObject, parseSafeUserResponse, requireHttpsUrl, requireInteger, requireString, normalizeUuid, } from "./validation.js";
|
|
5
6
|
import { openExternalBrowser } from "./browser.js";
|
|
6
7
|
import { OsMachineKeyProvider, } from "./machine-key.js";
|
|
7
8
|
import { TargetAuthorization, } from "./target-authorization.js";
|
|
@@ -71,6 +72,95 @@ export class AuthService {
|
|
|
71
72
|
throw error;
|
|
72
73
|
}
|
|
73
74
|
}
|
|
75
|
+
async signup(email, signal) {
|
|
76
|
+
const boundEmail = parseLoginEmail(email);
|
|
77
|
+
if ((await this.store.readAuthorization()) && (await this.status(signal))) {
|
|
78
|
+
throw new TeamClawsError("already_signed_in", "This CLI is already signed in. Signup will not switch accounts.", { exitCode: 3 });
|
|
79
|
+
}
|
|
80
|
+
const machineKey = await this.machineKeys.create();
|
|
81
|
+
const verifier = randomBytes(32).toString("base64url");
|
|
82
|
+
const response = await requestJson(this.fetcher, `${API_BASE}signup/`, {
|
|
83
|
+
method: "POST",
|
|
84
|
+
body: {
|
|
85
|
+
email: boundEmail,
|
|
86
|
+
code_challenge: createHash("sha256")
|
|
87
|
+
.update(verifier, "ascii")
|
|
88
|
+
.digest("base64url"),
|
|
89
|
+
machine_jwk: machineKey.public_jwk,
|
|
90
|
+
},
|
|
91
|
+
timeoutMs: null,
|
|
92
|
+
...(signal ? { signal } : {}),
|
|
93
|
+
}).catch(() => {
|
|
94
|
+
throw signupError(0, undefined);
|
|
95
|
+
});
|
|
96
|
+
if (response.status !== 202)
|
|
97
|
+
throw signupError(response.status, response.body);
|
|
98
|
+
if (!isObject(response.body))
|
|
99
|
+
throw invalidTokenResponse();
|
|
100
|
+
assertExactKeys(response.body, ["request_id", "expires_at"], [], "signup response");
|
|
101
|
+
const expiresAt = requireString(response.body.expires_at, "signup expiry", 64);
|
|
102
|
+
if (!Number.isFinite(Date.parse(expiresAt)))
|
|
103
|
+
throw invalidTokenResponse();
|
|
104
|
+
const requestId = normalizeUuid(response.body.request_id, "signup request identifier");
|
|
105
|
+
await this.store.writeSignup({
|
|
106
|
+
request_id: requestId,
|
|
107
|
+
email: boundEmail,
|
|
108
|
+
expires_at: expiresAt,
|
|
109
|
+
code_verifier: verifier,
|
|
110
|
+
machine_key: machineKey,
|
|
111
|
+
});
|
|
112
|
+
this.output.signupPending(requestId, boundEmail, expiresAt);
|
|
113
|
+
}
|
|
114
|
+
async verifySignup(code, signal) {
|
|
115
|
+
if (!/^[A-Za-z0-9_-]{43}$/u.test(code)) {
|
|
116
|
+
throw new TeamClawsError("invalid_command", "Provide the signup code through non-TTY stdin.", { exitCode: 2 });
|
|
117
|
+
}
|
|
118
|
+
if ((await this.store.readAuthorization()) && (await this.status(signal))) {
|
|
119
|
+
throw new TeamClawsError("already_signed_in", "This CLI is already signed in. Signup will not switch accounts.", { exitCode: 3 });
|
|
120
|
+
}
|
|
121
|
+
const pending = await this.store.readSignup();
|
|
122
|
+
if (!pending)
|
|
123
|
+
throw new TeamClawsError("signup_required", "Start signup with `teamclaws signup <email>` first.", { exitCode: 3 });
|
|
124
|
+
const url = `${API_BASE}signup/verify/`;
|
|
125
|
+
const signer = new TargetAuthorization(this.store, this.fetcher, this.machineKeys, this.now);
|
|
126
|
+
const response = await requestJson(this.fetcher, url, {
|
|
127
|
+
method: "POST",
|
|
128
|
+
headers: { DPoP: await signer.dpop(pending.machine_key, "POST", url) },
|
|
129
|
+
body: {
|
|
130
|
+
request_id: pending.request_id,
|
|
131
|
+
code,
|
|
132
|
+
code_verifier: pending.code_verifier,
|
|
133
|
+
},
|
|
134
|
+
timeoutMs: null,
|
|
135
|
+
...(signal ? { signal } : {}),
|
|
136
|
+
}).catch(() => {
|
|
137
|
+
throw signupError(0, undefined);
|
|
138
|
+
});
|
|
139
|
+
if (response.status !== 201)
|
|
140
|
+
throw signupError(response.status, response.body);
|
|
141
|
+
if (!isObject(response.body))
|
|
142
|
+
throw invalidTokenResponse();
|
|
143
|
+
assertExactKeys(response.body, ["authorization_id", "sub", "machine_jkt"], [], "signup verification response");
|
|
144
|
+
if (response.body.machine_jkt !== pending.machine_key.jkt)
|
|
145
|
+
throw invalidTokenResponse();
|
|
146
|
+
const grant = {
|
|
147
|
+
version: 2,
|
|
148
|
+
authorization_id: normalizeUuid(response.body.authorization_id, "authorization identifier"),
|
|
149
|
+
sub: requireString(response.body.sub, "user subject", 255),
|
|
150
|
+
machine_key: pending.machine_key,
|
|
151
|
+
};
|
|
152
|
+
const user = await this.fetchIdentity(grant, signal).catch(() => {
|
|
153
|
+
throw signupError(0, undefined);
|
|
154
|
+
});
|
|
155
|
+
if (user.id !== grant.sub ||
|
|
156
|
+
user.email.toLowerCase() !== pending.email.toLowerCase())
|
|
157
|
+
throw invalidTokenResponse();
|
|
158
|
+
await this.store.writeAuthorization(grant);
|
|
159
|
+
await this.store.removeLogin();
|
|
160
|
+
await this.store.removeSignup();
|
|
161
|
+
this.output.loginComplete(user);
|
|
162
|
+
return user;
|
|
163
|
+
}
|
|
74
164
|
async logout(signal, revokeGrant = false) {
|
|
75
165
|
const grant = await this.store.readAuthorization();
|
|
76
166
|
if (revokeGrant && grant) {
|
|
@@ -257,6 +347,27 @@ function invalidTokenResponse() {
|
|
|
257
347
|
exitCode: 9,
|
|
258
348
|
});
|
|
259
349
|
}
|
|
350
|
+
function signupError(status, body) {
|
|
351
|
+
const errors = {
|
|
352
|
+
invalid_signup: [400, "TeamClaws could not verify this signup."],
|
|
353
|
+
signup_expired: [410, "This signup code has expired."],
|
|
354
|
+
signup_cancelled: [409, "This signup was cancelled."],
|
|
355
|
+
signup_consumed: [409, "This signup code has already been used."],
|
|
356
|
+
request_limited: [
|
|
357
|
+
429,
|
|
358
|
+
"TeamClaws is limiting signup requests. No request was retried.",
|
|
359
|
+
],
|
|
360
|
+
issuer_unavailable: [
|
|
361
|
+
503,
|
|
362
|
+
"TeamClaws could not complete signup. The result is unconfirmed; do not automatically retry.",
|
|
363
|
+
],
|
|
364
|
+
};
|
|
365
|
+
const code = isObject(body) && isObject(body.error) ? body.error.code : undefined;
|
|
366
|
+
const known = typeof code === "string" ? errors[code] : undefined;
|
|
367
|
+
return new TeamClawsError(known && known[0] === status ? String(code) : "signup_unconfirmed", known && known[0] === status
|
|
368
|
+
? known[1]
|
|
369
|
+
: "TeamClaws did not confirm signup. Do not automatically retry.", { exitCode: 3 });
|
|
370
|
+
}
|
|
260
371
|
function oauthErrorCode(body) {
|
|
261
372
|
if (isObject(body) &&
|
|
262
373
|
typeof body.error === "string" &&
|
package/dist/constants.js
CHANGED
package/dist/output.js
CHANGED
|
@@ -42,6 +42,17 @@ export class Output {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
signupPending(requestId, email, expiresAt) {
|
|
46
|
+
this.event({
|
|
47
|
+
schema_version: OUTPUT_SCHEMA_VERSION,
|
|
48
|
+
event: "signup_pending",
|
|
49
|
+
request_id: requestId,
|
|
50
|
+
email,
|
|
51
|
+
expires_at: expiresAt,
|
|
52
|
+
});
|
|
53
|
+
if (!this.json)
|
|
54
|
+
this.stdout.write("If this email is eligible, check its inbox for a TeamClaws signup code. Provide it with `teamclaws signup verify --code-stdin`.\n");
|
|
55
|
+
}
|
|
45
56
|
loginComplete(user) {
|
|
46
57
|
this.event({
|
|
47
58
|
schema_version: OUTPUT_SCHEMA_VERSION,
|
package/dist/storage.js
CHANGED
|
@@ -5,6 +5,7 @@ import { homedir, tmpdir } from "node:os";
|
|
|
5
5
|
import { basename, dirname, join } from "node:path";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import { TeamClawsError } from "./errors.js";
|
|
8
|
+
import { jwkThumbprint } from "./machine-key.js";
|
|
8
9
|
import { parseDurableAuthorization, } from "./target-authorization.js";
|
|
9
10
|
import { canonicalWorkspaceOrigin, isObject, requireHttpsUrl, requireInteger, normalizeUuid, parseLoginCredential, parseStatusWorkspaceCredential, parseWorkspaceCredential, } from "./validation.js";
|
|
10
11
|
const execFile = promisify(execFileCallback);
|
|
@@ -15,12 +16,14 @@ export class CredentialStore {
|
|
|
15
16
|
root;
|
|
16
17
|
loginPath;
|
|
17
18
|
authorizationPath;
|
|
19
|
+
signupPath;
|
|
18
20
|
workspaceDirectory;
|
|
19
21
|
platform;
|
|
20
22
|
constructor(options = {}) {
|
|
21
23
|
this.root = options.root ?? defaultRoot();
|
|
22
24
|
this.loginPath = join(this.root, "cli-auth.json");
|
|
23
25
|
this.authorizationPath = join(this.root, "cli-authorization.json");
|
|
26
|
+
this.signupPath = join(this.root, "cli-signup.json");
|
|
24
27
|
this.workspaceDirectory = join(this.root, "clawgate-devices");
|
|
25
28
|
this.platform = options.platform ?? process.platform;
|
|
26
29
|
}
|
|
@@ -50,6 +53,19 @@ export class CredentialStore {
|
|
|
50
53
|
throw storageError();
|
|
51
54
|
});
|
|
52
55
|
}
|
|
56
|
+
async readSignup() {
|
|
57
|
+
const value = await this.readJsonIfPresent(this.signupPath);
|
|
58
|
+
return value === undefined ? undefined : parsePendingSignup(value);
|
|
59
|
+
}
|
|
60
|
+
async writeSignup(pending) {
|
|
61
|
+
await this.writePrivateJson(this.signupPath, parsePendingSignup(pending));
|
|
62
|
+
}
|
|
63
|
+
async removeSignup() {
|
|
64
|
+
await unlink(this.signupPath).catch((error) => {
|
|
65
|
+
if (error.code !== "ENOENT")
|
|
66
|
+
throw storageError();
|
|
67
|
+
});
|
|
68
|
+
}
|
|
53
69
|
workspacePath(serverId) {
|
|
54
70
|
return join(this.workspaceDirectory, `${normalizeUuid(serverId)}.json`);
|
|
55
71
|
}
|
|
@@ -454,6 +470,41 @@ export function decodeWindowsText(buffer) {
|
|
|
454
470
|
function storageError() {
|
|
455
471
|
return new TeamClawsError("credential_storage_failed", "TeamClaws could not protect the local credential file.", { exitCode: 9 });
|
|
456
472
|
}
|
|
473
|
+
function parsePendingSignup(value) {
|
|
474
|
+
if (!isObject(value) || !isObject(value.machine_key))
|
|
475
|
+
throw storageError();
|
|
476
|
+
const key = value.machine_key;
|
|
477
|
+
if (typeof value.email !== "string" ||
|
|
478
|
+
value.email.length > 254 ||
|
|
479
|
+
!value.email.includes("@") ||
|
|
480
|
+
typeof value.expires_at !== "string" ||
|
|
481
|
+
value.expires_at.length > 64 ||
|
|
482
|
+
!Number.isFinite(Date.parse(value.expires_at)) ||
|
|
483
|
+
typeof value.code_verifier !== "string" ||
|
|
484
|
+
!/^[A-Za-z0-9_-]{43}$/u.test(value.code_verifier) ||
|
|
485
|
+
!["windows-cng", "posix-file"].includes(String(key.provider)) ||
|
|
486
|
+
typeof key.name !== "string" ||
|
|
487
|
+
!/^teamclaws-cli-[0-9a-f-]{36}$/u.test(key.name) ||
|
|
488
|
+
!isObject(key.public_jwk) ||
|
|
489
|
+
key.public_jwk.kty !== "EC" ||
|
|
490
|
+
key.public_jwk.crv !== "P-256" ||
|
|
491
|
+
typeof key.public_jwk.x !== "string" ||
|
|
492
|
+
!/^[A-Za-z0-9_-]{43}$/u.test(key.public_jwk.x) ||
|
|
493
|
+
typeof key.public_jwk.y !== "string" ||
|
|
494
|
+
!/^[A-Za-z0-9_-]{43}$/u.test(key.public_jwk.y) ||
|
|
495
|
+
typeof key.jkt !== "string")
|
|
496
|
+
throw storageError();
|
|
497
|
+
const machineKey = key;
|
|
498
|
+
if (jwkThumbprint(machineKey.public_jwk) !== machineKey.jkt)
|
|
499
|
+
throw storageError();
|
|
500
|
+
return {
|
|
501
|
+
request_id: normalizeUuid(value.request_id, "signup request identifier"),
|
|
502
|
+
email: value.email,
|
|
503
|
+
expires_at: value.expires_at,
|
|
504
|
+
code_verifier: value.code_verifier,
|
|
505
|
+
machine_key: machineKey,
|
|
506
|
+
};
|
|
507
|
+
}
|
|
457
508
|
function parseConversationReference(value, credential) {
|
|
458
509
|
if (!isObject(value))
|
|
459
510
|
throw conversationStorageError();
|
package/package.json
CHANGED
|
@@ -5,6 +5,31 @@ description: Sign the official TeamClaws command-line client in, inspect its saf
|
|
|
5
5
|
|
|
6
6
|
# TeamClaws command-line login
|
|
7
7
|
|
|
8
|
+
## Authorized new-account signup
|
|
9
|
+
|
|
10
|
+
If the user authorized a new account and this agent already has permission to
|
|
11
|
+
read the supplied inbox, run `teamclaws signup <email> --json`. A
|
|
12
|
+
`signup_pending` event is conditional acceptance, not proof of mail delivery or
|
|
13
|
+
account creation. For eligible mailboxes, read the 15-minute single-use code.
|
|
14
|
+
Run `teamclaws signup verify --code-stdin --json` and supply the code plus a
|
|
15
|
+
newline using the execution tool's non-TTY stdin. Never expose the code in chat,
|
|
16
|
+
command arguments, shell text, logs, or files. The CLI handles its private verifier
|
|
17
|
+
and machine key itself. This path does not open a browser or read email for you.
|
|
18
|
+
|
|
19
|
+
The same commands can reconfirm only accounts whose access from this signup
|
|
20
|
+
flow was rejected; the backend checks eligibility and issues new authorization.
|
|
21
|
+
Start signup again after the denial and use that request's new emailed code;
|
|
22
|
+
do not reuse an earlier code or pending request for reconfirmation.
|
|
23
|
+
They are not email login for ordinary existing accounts. An active CLI login
|
|
24
|
+
blocks signup. Its normal status check may clear an authoritatively revoked
|
|
25
|
+
login, but preserves state and stops on network errors. Do not automatically
|
|
26
|
+
retry failed or unconfirmed signup. If an account was created and the successful
|
|
27
|
+
exchange response was lost, use the existing browser-login path for recovery.
|
|
28
|
+
After `login_complete` and exit zero, continue normal discovery and ask which
|
|
29
|
+
workspace the user wants. Signup itself never buys or pairs a workspace.
|
|
30
|
+
|
|
31
|
+
## Existing account browser login
|
|
32
|
+
|
|
8
33
|
For install-and-connect requests, follow
|
|
9
34
|
[teamclaws-onboard](../teamclaws-onboard/SKILL.md) for the conversation sequence.
|
|
10
35
|
A status-only request runs only `teamclaws auth status --json` and stops.
|
|
@@ -44,6 +44,16 @@ workspace user; user membership is a separate privilege.
|
|
|
44
44
|
|
|
45
45
|
## Sign in
|
|
46
46
|
|
|
47
|
+
For an authorized new account, or fresh confirmation after access from this
|
|
48
|
+
signup flow was rejected, an agent with already authorized inbox access can use
|
|
49
|
+
the two signup commands in [teamclaws-login](../teamclaws-login/SKILL.md).
|
|
50
|
+
Explain that the email code authorizes this CLI; keep it out of chat and command
|
|
51
|
+
arguments and supply it through non-TTY stdin. `signup_pending` is not confirmed
|
|
52
|
+
delivery or account creation. Wait for `login_complete` and exit zero before
|
|
53
|
+
discovery. Do not infer new-account eligibility from signed-out status, add
|
|
54
|
+
mailbox access, automatically retry, or pair without a workspace selection.
|
|
55
|
+
Ordinary existing accounts continue through the browser-login steps below.
|
|
56
|
+
|
|
47
57
|
Run `teamclaws auth status --json`. If signed in, confirm the returned account
|
|
48
58
|
and continue without another login. If signed out, follow
|
|
49
59
|
[teamclaws-login](../teamclaws-login/SKILL.md): ask for the user's TeamClaws email
|