teamclaws 2.0.25 → 2.0.26
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 +11 -11
- package/dist/app.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/shell.js +24 -8
- package/dist/target-authorization.js +31 -0
- package/package.json +1 -1
- package/skills/teamclaws-login/SKILL.md +3 -0
- package/skills/teamclaws-onboard/SKILL.md +4 -0
- package/skills/teamclaws-onboard/references/workspace-uses.md +4 -2
- package/skills/teamclaws-pair/SKILL.md +7 -11
- package/skills/teamclaws-project/SKILL.md +5 -0
package/README.md
CHANGED
|
@@ -432,18 +432,18 @@ to a specific request, so neither command checks for later conversation turns.
|
|
|
432
432
|
|
|
433
433
|
## Host shell commands
|
|
434
434
|
|
|
435
|
-
For authorized workspace administration,
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
435
|
+
For authorized workspace administration, sign in with `teamclaws login <email>`
|
|
436
|
+
and select a workspace through `teamclaws servers list --json`. Shell access
|
|
437
|
+
does not require a saved device pairing, linked AI provider, or TCChat conversation.
|
|
438
|
+
TeamClaws checks the signed-in account's workspace access for each shell proof.
|
|
439
|
+
|
|
440
|
+
`teamclaws shell <target> --command <text> [--json]` executes the exact command
|
|
441
|
+
text on the workspace host. An existing saved pairing keeps its current
|
|
442
|
+
authentication path. Without one, the CLI resolves the exact stable identifier
|
|
443
|
+
or canonical workspace address through account discovery and obtains a
|
|
444
|
+
machine-bound shell proof. It saves neither the proof nor a pairing. Quote the
|
|
444
445
|
command as one local shell argument; quotes, pipes and newlines inside that
|
|
445
|
-
argument are preserved.
|
|
446
|
-
directory. The command does not log in, pair, or load chat capabilities.
|
|
446
|
+
argument are preserved. Use `pwd` in the command to inspect the workspace working directory. The command does not log in, pair, or load chat capabilities.
|
|
447
447
|
|
|
448
448
|
Normal mode forwards stdout and stderr without adding text. JSON mode emits one
|
|
449
449
|
object with `stdout`, `stderr`, and `exit_code`. Both modes return the remote
|
package/dist/app.js
CHANGED
|
@@ -162,7 +162,7 @@ export async function run(arguments_, dependencies = {}, signal) {
|
|
|
162
162
|
return result.ok === true ? 0 : 1;
|
|
163
163
|
}
|
|
164
164
|
case "shell": {
|
|
165
|
-
const result = await runShell(store, dependencies.fetcher ?? shellFetch, parsePairingTarget(parsed.target), parsed.command, targetAuthorization, signal);
|
|
165
|
+
const result = await runShell(store, dependencies.fetcher ?? shellFetch, parsePairingTarget(parsed.target), parsed.command, targetAuthorization, broker, signal);
|
|
166
166
|
if (parsed.json)
|
|
167
167
|
stdout.write(`${JSON.stringify(result)}\n`);
|
|
168
168
|
else {
|
package/dist/constants.js
CHANGED
package/dist/shell.js
CHANGED
|
@@ -2,22 +2,38 @@ import { request as httpRequest } from "node:http";
|
|
|
2
2
|
import { request as httpsRequest } from "node:https";
|
|
3
3
|
import { Readable } from "node:stream";
|
|
4
4
|
import { TeamClawsError } from "./errors.js";
|
|
5
|
-
import { errorFromResponse } from "./http.js";
|
|
5
|
+
import { errorFromResponse, requestJson } from "./http.js";
|
|
6
6
|
import { requestTargetJson } from "./target-authorization.js";
|
|
7
7
|
import { isObject } from "./validation.js";
|
|
8
|
-
export async function runShell(store, fetcher, target, command, authorization, signal) {
|
|
8
|
+
export async function runShell(store, fetcher, target, command, authorization, broker, signal) {
|
|
9
9
|
const credential = await store.findWorkspace(target);
|
|
10
|
-
|
|
11
|
-
throw new TeamClawsError("re_pair_required", "No saved pairing was found for this workspace. Pair it first.", { exitCode: 3 });
|
|
12
|
-
}
|
|
13
|
-
const url = `${credential.origin}/teamclaws-admin/api/shell/`;
|
|
14
|
-
const response = await requestTargetJson(fetcher, authorization, url, credential, {
|
|
10
|
+
const options = {
|
|
15
11
|
method: "POST",
|
|
16
12
|
textBody: command,
|
|
17
13
|
timeoutMs: null,
|
|
18
14
|
responseLimitBytes: null,
|
|
19
15
|
...(signal ? { signal } : {}),
|
|
20
|
-
}
|
|
16
|
+
};
|
|
17
|
+
let response;
|
|
18
|
+
if (credential) {
|
|
19
|
+
const url = `${credential.origin}/teamclaws-admin/api/shell/`;
|
|
20
|
+
response = await requestTargetJson(fetcher, authorization, url, credential, options);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const inventory = await broker.servers(signal);
|
|
24
|
+
const matches = inventory.servers.filter((server) => "server_id" in target
|
|
25
|
+
? server.server_id === target.server_id
|
|
26
|
+
: new URL(server.workspace_url).origin ===
|
|
27
|
+
new URL(target.workspace_url).origin);
|
|
28
|
+
if (matches.length !== 1)
|
|
29
|
+
throw new TeamClawsError("target_unavailable", "The selected workspace is not available to this TeamClaws account.", { exitCode: 3 });
|
|
30
|
+
const server = matches[0];
|
|
31
|
+
const url = `${new URL(server.workspace_url).origin}/teamclaws-admin/api/shell/`;
|
|
32
|
+
response = await requestJson(fetcher, url, {
|
|
33
|
+
...options,
|
|
34
|
+
headers: await authorization.headersForAccountShell("POST", url, server, signal),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
21
37
|
if (response.status !== 200)
|
|
22
38
|
throw errorFromResponse(response, "shell_failed");
|
|
23
39
|
const result = response.body;
|
|
@@ -80,6 +80,37 @@ export class TargetAuthorization {
|
|
|
80
80
|
DPoP: await this.dpop(grant.machine_key, method, url, proof, pairingAuthorization),
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
+
async headersForAccountShell(method, url, server, signal) {
|
|
84
|
+
const grant = await this.requireGrant();
|
|
85
|
+
if (new URL(url).origin !== new URL(server.workspace_url).origin)
|
|
86
|
+
throw new TeamClawsError("target_mismatch", "The request target does not match the selected workspace.", { exitCode: 9 });
|
|
87
|
+
const exchangeUrl = `${API_V2_BASE}authorizations/${grant.authorization_id}/shell-proofs/`;
|
|
88
|
+
const exchange = await requestJson(this.fetcher, exchangeUrl, {
|
|
89
|
+
method: "POST",
|
|
90
|
+
headers: {
|
|
91
|
+
DPoP: await this.dpop(grant.machine_key, "POST", exchangeUrl),
|
|
92
|
+
},
|
|
93
|
+
body: { server_id: server.server_id, scope: "workspace:shell" },
|
|
94
|
+
...(signal ? { signal } : {}),
|
|
95
|
+
});
|
|
96
|
+
if (exchange.status < 200 || exchange.status >= 300)
|
|
97
|
+
throw errorFromResponse(exchange, "target_proof_denied");
|
|
98
|
+
if (!isObject(exchange.body) ||
|
|
99
|
+
exchange.body.token_type !== "DPoP" ||
|
|
100
|
+
exchange.body.scope !== "workspace:shell" ||
|
|
101
|
+
typeof exchange.body.access_token !== "string" ||
|
|
102
|
+
exchange.body.access_token.length < 16 ||
|
|
103
|
+
exchange.body.access_token.length > 8192 ||
|
|
104
|
+
!Number.isInteger(exchange.body.expires_in) ||
|
|
105
|
+
exchange.body.expires_in < 1 ||
|
|
106
|
+
exchange.body.expires_in > 300)
|
|
107
|
+
throw new TeamClawsError("invalid_response", "TeamClaws returned an invalid shell proof.", { exitCode: 9 });
|
|
108
|
+
const proof = exchange.body.access_token;
|
|
109
|
+
return {
|
|
110
|
+
Authorization: `DPoP ${proof}`,
|
|
111
|
+
DPoP: await this.dpop(grant.machine_key, method, url, proof),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
83
114
|
async dpop(key, method, url, targetProof, pairingAuthorization) {
|
|
84
115
|
const parsed = new URL(url);
|
|
85
116
|
if (parsed.protocol !== "https:" || parsed.username || parsed.password)
|
package/package.json
CHANGED
|
@@ -52,6 +52,9 @@ show browser approval only if the CLI requests it. If onboarding
|
|
|
52
52
|
already explained the process, use a short transition into this step. Give the
|
|
53
53
|
approval link with that context, never as an unexplained authorization request.
|
|
54
54
|
|
|
55
|
+
After login, authorized shell commands can run on a selected workspace without
|
|
56
|
+
a saved device pairing. Do not start pairing for a shell-only request.
|
|
57
|
+
|
|
55
58
|
Pairing connects this computer to the workspace. It does not add a person as a
|
|
56
59
|
workspace user; user membership is a separate privilege.
|
|
57
60
|
|
|
@@ -90,6 +90,10 @@ of browser approval. After `login_complete` and exit 0, confirm the account and
|
|
|
90
90
|
immediately continue to workspace discovery. Denial, expiry, and network failure
|
|
91
91
|
are distinct failures; report the actual result without claiming success.
|
|
92
92
|
|
|
93
|
+
For a shell-only request, discover the selected workspace and run the authorized
|
|
94
|
+
`teamclaws shell` command after login. A saved device pairing is not required;
|
|
95
|
+
do not start the pairing journey for that request.
|
|
96
|
+
|
|
93
97
|
## Choose workspaces
|
|
94
98
|
|
|
95
99
|
Run `teamclaws servers list --json`. Use only a successful `servers_list` event;
|
|
@@ -12,9 +12,11 @@ A TeamClaws workspace provides a VPS: a virtual private server with its own
|
|
|
12
12
|
server environment, storage, installed tools, and running processes. Within the
|
|
13
13
|
account's permissions and the machine's resources, it can hold complete projects
|
|
14
14
|
and execute their workloads. The official CLI can launch commands through the
|
|
15
|
-
|
|
15
|
+
workspace shell, place authorized files on the machine, inspect results, and help
|
|
16
16
|
set up applications and services. A linked AI provider is not required for shell
|
|
17
|
-
work.
|
|
17
|
+
work. Shell-only commands can use account login without a saved device pairing;
|
|
18
|
+
the CLI checks account access and binds each shell proof to this computer.
|
|
19
|
+
There is no dedicated `teamclaws deploy` or file-transfer command; use the
|
|
18
20
|
paired shell and the project skill's supported transfer and hosting procedures.
|
|
19
21
|
|
|
20
22
|
Think of it as a workshop the user and their agents can reach from different
|
|
@@ -139,22 +139,18 @@ still stops at its status result.
|
|
|
139
139
|
|
|
140
140
|
## Authorized workspace administration
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
before assuming that a linked AI provider or TCChat conversation is needed:
|
|
144
|
-
|
|
145
|
-
```text
|
|
146
|
-
teamclaws pair status <stable-server-identifier-or-canonical-workspace-address> --json
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
If it reports `not_paired`, follow the login and pairing flow above for that
|
|
150
|
-
selected workspace; follow browser approval only if `pairing_browser_required` is emitted. Do not use
|
|
151
|
-
another workspace's pairing or bypass approval. After `paired` is verified,
|
|
152
|
-
authorized host commands can use the existing paired shell:
|
|
142
|
+
For authorized host shell work on a selected workspace, use:
|
|
153
143
|
|
|
154
144
|
```text
|
|
155
145
|
teamclaws shell <target> --command <one-quoted-command-argument> --json
|
|
156
146
|
```
|
|
157
147
|
|
|
148
|
+
A valid CLI login is required. Without a saved device pairing, the CLI discovers
|
|
149
|
+
the selected workspace and requests an account-authorized, machine-bound shell
|
|
150
|
+
proof. Do not start pairing merely to run a shell command. Existing saved
|
|
151
|
+
pairings retain their current authentication path. Shell authorization does not
|
|
152
|
+
add a workspace user or create a device pairing.
|
|
153
|
+
|
|
158
154
|
Check the shell result's `exit_code` and verify the requested outcome. Do not
|
|
159
155
|
retry a command automatically after an uncertain transport failure. Device
|
|
160
156
|
pairing and a linked AI provider are separate; the shell does not require a
|
|
@@ -40,6 +40,11 @@ and verification. Projects are visible workspace-wide by default; hiding is pers
|
|
|
40
40
|
A non-owner superuser cannot delete an owner-created project through this functionality.
|
|
41
41
|
These commands do not change unrelated shell or filesystem access.
|
|
42
42
|
|
|
43
|
+
For shell-only administration, a valid CLI account login can authorize
|
|
44
|
+
`teamclaws shell` without a saved device pairing. Do not start pairing merely
|
|
45
|
+
to run that command. The project lifecycle and transfer instructions below
|
|
46
|
+
retain their own prerequisites.
|
|
47
|
+
|
|
43
48
|
## Jobs, services, and external systems
|
|
44
49
|
|
|
45
50
|
For a complete job, place its code and authorized inputs in a dedicated directory,
|