teamclaws 1.0.0
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/LICENSE +167 -0
- package/README.md +107 -0
- package/dist/app.js +327 -0
- package/dist/app.js.map +1 -0
- package/dist/auth.js +330 -0
- package/dist/auth.js.map +1 -0
- package/dist/broker.js +79 -0
- package/dist/broker.js.map +1 -0
- package/dist/browser.js +33 -0
- package/dist/browser.js.map +1 -0
- package/dist/cli.js +14 -0
- package/dist/cli.js.map +1 -0
- package/dist/constants.js +21 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors.js +20 -0
- package/dist/errors.js.map +1 -0
- package/dist/external-chat.js +570 -0
- package/dist/external-chat.js.map +1 -0
- package/dist/http.js +107 -0
- package/dist/http.js.map +1 -0
- package/dist/output.js +298 -0
- package/dist/output.js.map +1 -0
- package/dist/pairing.js +245 -0
- package/dist/pairing.js.map +1 -0
- package/dist/storage.js +324 -0
- package/dist/storage.js.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/validation.js +458 -0
- package/dist/validation.js.map +1 -0
- package/package.json +42 -0
- package/skills/teamclaws-chat/SKILL.md +65 -0
- package/skills/teamclaws-login/SKILL.md +29 -0
- package/skills/teamclaws-pair/SKILL.md +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Required Notice: Copyright GetTeamClaws (https://teamclaws.com)
|
|
2
|
+
Licensor Line of Business: TeamClaws (https://teamclaws.com)
|
|
3
|
+
|
|
4
|
+
# PolyForm Shield License 1.0.0
|
|
5
|
+
|
|
6
|
+
<https://polyformproject.org/licenses/shield/1.0.0>
|
|
7
|
+
|
|
8
|
+
## Acceptance
|
|
9
|
+
|
|
10
|
+
In order to get any license under these terms, you must agree
|
|
11
|
+
to them as both strict obligations and conditions to all
|
|
12
|
+
your licenses.
|
|
13
|
+
|
|
14
|
+
## Copyright License
|
|
15
|
+
|
|
16
|
+
The licensor grants you a copyright license for the
|
|
17
|
+
software to do everything you might do with the software
|
|
18
|
+
that would otherwise infringe the licensor's copyright
|
|
19
|
+
in it for any permitted purpose. However, you may
|
|
20
|
+
only distribute the software according to [Distribution
|
|
21
|
+
License](#distribution-license) and make changes or new works
|
|
22
|
+
based on the software according to [Changes and New Works
|
|
23
|
+
License](#changes-and-new-works-license).
|
|
24
|
+
|
|
25
|
+
## Distribution License
|
|
26
|
+
|
|
27
|
+
The licensor grants you an additional copyright license
|
|
28
|
+
to distribute copies of the software. Your license
|
|
29
|
+
to distribute covers distributing the software with
|
|
30
|
+
changes and new works permitted by [Changes and New Works
|
|
31
|
+
License](#changes-and-new-works-license).
|
|
32
|
+
|
|
33
|
+
## Notices
|
|
34
|
+
|
|
35
|
+
You must ensure that anyone who gets a copy of any part of
|
|
36
|
+
the software from you also gets a copy of these terms or the
|
|
37
|
+
URL for them above, as well as copies of any plain-text lines
|
|
38
|
+
beginning with `Required Notice:` that the licensor provided
|
|
39
|
+
with the software. For example:
|
|
40
|
+
|
|
41
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
42
|
+
|
|
43
|
+
## Changes and New Works License
|
|
44
|
+
|
|
45
|
+
The licensor grants you an additional copyright license to
|
|
46
|
+
make changes and new works based on the software for any
|
|
47
|
+
permitted purpose.
|
|
48
|
+
|
|
49
|
+
## Patent License
|
|
50
|
+
|
|
51
|
+
The licensor grants you a patent license for the software that
|
|
52
|
+
covers patent claims the licensor can license, or becomes able
|
|
53
|
+
to license, that you would infringe by using the software.
|
|
54
|
+
|
|
55
|
+
## Noncompete
|
|
56
|
+
|
|
57
|
+
Any purpose is a permitted purpose, except for providing any
|
|
58
|
+
product that competes with the software or any product the
|
|
59
|
+
licensor or any of its affiliates provides using the software.
|
|
60
|
+
|
|
61
|
+
## Competition
|
|
62
|
+
|
|
63
|
+
Goods and services compete even when they provide functionality
|
|
64
|
+
through different kinds of interfaces or for different technical
|
|
65
|
+
platforms. Applications can compete with services, libraries
|
|
66
|
+
with plugins, frameworks with development tools, and so on,
|
|
67
|
+
even if they're written in different programming languages
|
|
68
|
+
or for different computer architectures. Goods and services
|
|
69
|
+
compete even when provided free of charge. If you market a
|
|
70
|
+
product as a practical substitute for the software or another
|
|
71
|
+
product, it definitely competes.
|
|
72
|
+
|
|
73
|
+
## New Products
|
|
74
|
+
|
|
75
|
+
If you are using the software to provide a product that does
|
|
76
|
+
not compete, but the licensor or any of its affiliates brings
|
|
77
|
+
your product into competition by providing a new version of
|
|
78
|
+
the software or another product using the software, you may
|
|
79
|
+
continue using versions of the software available under these
|
|
80
|
+
terms beforehand to provide your competing product, but not
|
|
81
|
+
any later versions.
|
|
82
|
+
|
|
83
|
+
## Discontinued Products
|
|
84
|
+
|
|
85
|
+
You may begin using the software to compete with a product
|
|
86
|
+
or service that the licensor or any of its affiliates has
|
|
87
|
+
stopped providing, unless the licensor includes a plain-text
|
|
88
|
+
line beginning with `Licensor Line of Business:` with the
|
|
89
|
+
software that mentions that line of business. For example:
|
|
90
|
+
|
|
91
|
+
> Licensor Line of Business: YoyodyneCMS Content Management
|
|
92
|
+
System (http://example.com/cms)
|
|
93
|
+
|
|
94
|
+
## Sales of Business
|
|
95
|
+
|
|
96
|
+
If the licensor or any of its affiliates sells a line of
|
|
97
|
+
business developing the software or using the software
|
|
98
|
+
to provide a product, the buyer can also enforce
|
|
99
|
+
[Noncompete](#noncompete) for that product.
|
|
100
|
+
|
|
101
|
+
## Fair Use
|
|
102
|
+
|
|
103
|
+
You may have "fair use" rights for the software under the
|
|
104
|
+
law. These terms do not limit them.
|
|
105
|
+
|
|
106
|
+
## No Other Rights
|
|
107
|
+
|
|
108
|
+
These terms do not allow you to sublicense or transfer any of
|
|
109
|
+
your licenses to anyone else, or prevent the licensor from
|
|
110
|
+
granting licenses to anyone else. These terms do not imply
|
|
111
|
+
any other licenses.
|
|
112
|
+
|
|
113
|
+
## Patent Defense
|
|
114
|
+
|
|
115
|
+
If you make any written claim that the software infringes or
|
|
116
|
+
contributes to infringement of any patent, your patent license
|
|
117
|
+
for the software granted under these terms ends immediately. If
|
|
118
|
+
your company makes such a claim, your patent license ends
|
|
119
|
+
immediately for work on behalf of your company.
|
|
120
|
+
|
|
121
|
+
## Violations
|
|
122
|
+
|
|
123
|
+
The first time you are notified in writing that you have
|
|
124
|
+
violated any of these terms, or done anything with the software
|
|
125
|
+
not covered by your licenses, your licenses can nonetheless
|
|
126
|
+
continue if you come into full compliance with these terms,
|
|
127
|
+
and take practical steps to correct past violations, within
|
|
128
|
+
32 days of receiving notice. Otherwise, all your licenses
|
|
129
|
+
end immediately.
|
|
130
|
+
|
|
131
|
+
## No Liability
|
|
132
|
+
|
|
133
|
+
***As far as the law allows, the software comes as is, without
|
|
134
|
+
any warranty or condition, and the licensor will not be liable
|
|
135
|
+
to you for any damages arising out of these terms or the use
|
|
136
|
+
or nature of the software, under any kind of legal claim.***
|
|
137
|
+
|
|
138
|
+
## Definitions
|
|
139
|
+
|
|
140
|
+
The **licensor** is the individual or entity offering these
|
|
141
|
+
terms, and the **software** is the software the licensor makes
|
|
142
|
+
available under these terms.
|
|
143
|
+
|
|
144
|
+
A **product** can be a good or service, or a combination
|
|
145
|
+
of them.
|
|
146
|
+
|
|
147
|
+
**You** refers to the individual or entity agreeing to these
|
|
148
|
+
terms.
|
|
149
|
+
|
|
150
|
+
**Your company** is any legal entity, sole proprietorship,
|
|
151
|
+
or other kind of organization that you work for, plus all
|
|
152
|
+
its affiliates.
|
|
153
|
+
|
|
154
|
+
**Affiliates** means the other organizations than an
|
|
155
|
+
organization has control over, is under the control of, or is
|
|
156
|
+
under common control with.
|
|
157
|
+
|
|
158
|
+
**Control** means ownership of substantially all the assets of
|
|
159
|
+
an entity, or the power to direct its management and policies
|
|
160
|
+
by vote, contract, or otherwise. Control can be direct or
|
|
161
|
+
indirect.
|
|
162
|
+
|
|
163
|
+
**Your licenses** are all the licenses granted to you for the
|
|
164
|
+
software under these terms.
|
|
165
|
+
|
|
166
|
+
**Use** means anything you do with the software requiring one
|
|
167
|
+
of your licenses.
|
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# TeamClaws client
|
|
2
|
+
|
|
3
|
+
The official TeamClaws command-line client pairs a filesystem-capable computer
|
|
4
|
+
with a TeamClaws workspace and stores the resulting Clawgate credential on that
|
|
5
|
+
computer. The command-line client and its agent skills ship together in this
|
|
6
|
+
package.
|
|
7
|
+
|
|
8
|
+
## Requirements
|
|
9
|
+
|
|
10
|
+
- Node.js 22 or newer
|
|
11
|
+
- Windows 11 or Windows Server 2022 or newer, macOS 14 or newer, or a modern
|
|
12
|
+
GNU/Linux distribution with glibc 2.28 or newer
|
|
13
|
+
- x64 or ARM64
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
npx teamclaws login
|
|
19
|
+
npx teamclaws login <email>
|
|
20
|
+
npx teamclaws auth status
|
|
21
|
+
npx teamclaws logout
|
|
22
|
+
npx teamclaws servers list
|
|
23
|
+
npx teamclaws pair status <server-identifier-or-canonical-workspace-address>
|
|
24
|
+
npx teamclaws pair
|
|
25
|
+
npx teamclaws pair <server-identifier-or-canonical-workspace-address> [--no-open]
|
|
26
|
+
npx teamclaws chat start <target> --message <text>
|
|
27
|
+
npx teamclaws chat send <target> --session-id <uuid> --message <text>
|
|
28
|
+
npx teamclaws chat watch <target> --session-id <uuid> --request-id <uuid>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Human-readable output is the default. Add `--json` for the strict, versioned,
|
|
32
|
+
newline-delimited JSON event stream intended for automation.
|
|
33
|
+
|
|
34
|
+
Pairing is broad privileged delegation to the approved workspace. The client
|
|
35
|
+
does not request or select scopes, profiles, capability bundles, roles, user
|
|
36
|
+
types, or permission labels. TeamClaws, Clawgate, and host policy determine the
|
|
37
|
+
authority of the approved credential.
|
|
38
|
+
|
|
39
|
+
The client never accepts a model or harness access token. An agent that already
|
|
40
|
+
discovered a workspace passes only the selected stable server identifier to the
|
|
41
|
+
`pair` command.
|
|
42
|
+
|
|
43
|
+
`pair status` is side-effect free: it reads only the matching protected local
|
|
44
|
+
credential, performs at most one direct workspace verification with a
|
|
45
|
+
five-second timeout, reports the result, and stops. It never starts pairing or
|
|
46
|
+
loads external-chat resources.
|
|
47
|
+
|
|
48
|
+
After pairing, `chat start`, `chat send`, and `chat watch` use the protected
|
|
49
|
+
workspace credential directly against that exact workspace. They verify the
|
|
50
|
+
authoritative versioned handoff, resolve the workspace capability catalog, and
|
|
51
|
+
stream only allowlisted durable request events. They never send the workspace
|
|
52
|
+
credential through `www.teamclaws.com` or download and execute the generated
|
|
53
|
+
Python helper. Use `--client-request-id <uuid>` to safely repeat an uncertain
|
|
54
|
+
create request, and use the watch cursors printed in JSON events to resume
|
|
55
|
+
monitoring without creating another turn.
|
|
56
|
+
|
|
57
|
+
## Local storage
|
|
58
|
+
|
|
59
|
+
Login credentials are stored in the private TeamClaws user directory. Completed
|
|
60
|
+
workspace credentials are stored by stable server identifier beneath
|
|
61
|
+
`~/.teamclaws/clawgate-devices/<server-uuid>.json`. Writes are atomic. Unix
|
|
62
|
+
directories use mode `0700` and files use mode `0600`; Windows uses
|
|
63
|
+
inheritance-disabled access-control entries limited to the current user and the
|
|
64
|
+
Windows system account.
|
|
65
|
+
|
|
66
|
+
## Development
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
npm ci
|
|
70
|
+
npm run verify
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The package is licensed under the PolyForm Shield License 1.0.0. Paid service
|
|
74
|
+
access is enforced by TeamClaws servers, not by the client license.
|
|
75
|
+
|
|
76
|
+
### Provider and model capabilities
|
|
77
|
+
|
|
78
|
+
Run `teamclaws chat capabilities <target> [--json]` with an existing saved
|
|
79
|
+
workspace pairing. It reads the workspace capabilities endpoint with a shared
|
|
80
|
+
120-second budget, attempts lasting at most 15 seconds, and pauses of up to five
|
|
81
|
+
seconds between retryable failures or inventories with no model choices. It does not
|
|
82
|
+
log in, pair, or start a chat. Without a saved pairing it makes no request.
|
|
83
|
+
|
|
84
|
+
JSON output is one `chat_capabilities` event with `schema_version: 1`,
|
|
85
|
+
`status: "success"`, `source: "refresh"`, the safe workspace ID/origin, and
|
|
86
|
+
`external_chat_capabilities`. This is a reduced public projection: provider/model
|
|
87
|
+
IDs, supported reasoning levels, fast availability, recommendation, capability
|
|
88
|
+
read/create/write scopes, identity alias, fast-mode policy and chat limits. Device
|
|
89
|
+
credentials, internal identity IDs and unknown server fields are not emitted.
|
|
90
|
+
Human output lists the same model choices and effective fast availability.
|
|
91
|
+
|
|
92
|
+
Successful explicit pairing also includes `external_chat_capabilities` and its
|
|
93
|
+
sibling `external_chat_capabilities_generated_at` when the target supplies them.
|
|
94
|
+
This consumes the token-delivery snapshot without any additional request and does
|
|
95
|
+
not save a capability cache. The snapshot is emitted only after credential
|
|
96
|
+
verification. Older targets without these fields still pair successfully. Null,
|
|
97
|
+
malformed or unsupported optional data produces null fields, without invalidating
|
|
98
|
+
a valid pairing. A pairing snapshot can contain an authorized empty inventory:
|
|
99
|
+
`providers: []` and `recommended_selection: null`. Explicit capability discovery
|
|
100
|
+
retries inventories with no model choices within the shared budget, then returns
|
|
101
|
+
`capabilities_unavailable` with exit code 5 if no choices become available.
|
|
102
|
+
|
|
103
|
+
The timestamp describes snapshot generation, not an authorization lease. The
|
|
104
|
+
existing refresh endpoint does not supply a generation timestamp. Chat requests
|
|
105
|
+
still validate current authorization and selection; explicitly refresh if a
|
|
106
|
+
selection is no longer available. No chat mutation is automatically replayed by
|
|
107
|
+
this command. Pair status retains its one-request, terminal behavior.
|
package/dist/app.js
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { createInterface } from "node:readline/promises";
|
|
2
|
+
import { AuthService } from "./auth.js";
|
|
3
|
+
import { BrokerClient } from "./broker.js";
|
|
4
|
+
import { PACKAGE_VERSION } from "./constants.js";
|
|
5
|
+
import { TeamClawsError, safeError } from "./errors.js";
|
|
6
|
+
import { ExternalChatClient, } from "./external-chat.js";
|
|
7
|
+
import { Output } from "./output.js";
|
|
8
|
+
import { PairingClient } from "./pairing.js";
|
|
9
|
+
import { CredentialStore } from "./storage.js";
|
|
10
|
+
import { parsePairingTarget } from "./validation.js";
|
|
11
|
+
export async function run(arguments_, dependencies = {}, signal) {
|
|
12
|
+
let parsed;
|
|
13
|
+
try {
|
|
14
|
+
parsed = parseArguments(arguments_);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
const json = arguments_.includes("--json");
|
|
18
|
+
const output = new Output(json, dependencies.io?.stdout ?? process.stdout, dependencies.io?.stderr ?? process.stderr);
|
|
19
|
+
const safe = safeError(error);
|
|
20
|
+
output.error(safe);
|
|
21
|
+
return safe.exitCode;
|
|
22
|
+
}
|
|
23
|
+
const stdout = dependencies.io?.stdout ?? process.stdout;
|
|
24
|
+
const stderr = dependencies.io?.stderr ?? process.stderr;
|
|
25
|
+
const output = new Output(parsed.json, stdout, stderr);
|
|
26
|
+
if (parsed.action === "help") {
|
|
27
|
+
stdout.write(helpText());
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
if (parsed.action === "version") {
|
|
31
|
+
stdout.write(`${PACKAGE_VERSION}\n`);
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
const store = dependencies.store ?? new CredentialStore();
|
|
35
|
+
const auth = new AuthService({
|
|
36
|
+
store,
|
|
37
|
+
output,
|
|
38
|
+
...(dependencies.fetcher ? { fetcher: dependencies.fetcher } : {}),
|
|
39
|
+
...(dependencies.openBrowser
|
|
40
|
+
? { openBrowser: dependencies.openBrowser }
|
|
41
|
+
: {}),
|
|
42
|
+
});
|
|
43
|
+
const broker = new BrokerClient({
|
|
44
|
+
...(dependencies.fetcher ? { fetcher: dependencies.fetcher } : {}),
|
|
45
|
+
});
|
|
46
|
+
const pairing = new PairingClient({
|
|
47
|
+
store,
|
|
48
|
+
output,
|
|
49
|
+
...(dependencies.fetcher ? { fetcher: dependencies.fetcher } : {}),
|
|
50
|
+
...(dependencies.openBrowser
|
|
51
|
+
? { openBrowser: dependencies.openBrowser }
|
|
52
|
+
: {}),
|
|
53
|
+
});
|
|
54
|
+
const externalChat = new ExternalChatClient({
|
|
55
|
+
store,
|
|
56
|
+
output,
|
|
57
|
+
...(dependencies.fetcher ? { fetcher: dependencies.fetcher } : {}),
|
|
58
|
+
});
|
|
59
|
+
try {
|
|
60
|
+
switch (parsed.action) {
|
|
61
|
+
case "login":
|
|
62
|
+
await auth.login(parsed.email, signal);
|
|
63
|
+
return 0;
|
|
64
|
+
case "auth_status":
|
|
65
|
+
await auth.status(signal);
|
|
66
|
+
return 0;
|
|
67
|
+
case "logout":
|
|
68
|
+
await auth.logout(signal);
|
|
69
|
+
return 0;
|
|
70
|
+
case "servers_list": {
|
|
71
|
+
const token = await auth.accessToken(signal);
|
|
72
|
+
if (!token)
|
|
73
|
+
throw loginRequired();
|
|
74
|
+
const servers = await broker.servers(token, signal);
|
|
75
|
+
output.servers(servers);
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
case "pair": {
|
|
79
|
+
const token = await auth.accessToken(signal);
|
|
80
|
+
const target = parsed.target
|
|
81
|
+
? parsePairingTarget(parsed.target)
|
|
82
|
+
: await discoverTarget(broker, token, parsed.json, output, dependencies.io, signal);
|
|
83
|
+
const pending = await broker.startPairing(target, token, signal);
|
|
84
|
+
await pairing.complete(pending, broker.currentDeviceName(), parsed.noOpen, signal);
|
|
85
|
+
return 0;
|
|
86
|
+
}
|
|
87
|
+
case "pair_status": {
|
|
88
|
+
const status = await pairing.status(parsePairingTarget(parsed.target), signal);
|
|
89
|
+
return status === "paired" ? 0 : status === "unreachable" ? 5 : 1;
|
|
90
|
+
}
|
|
91
|
+
case "chat_capabilities":
|
|
92
|
+
return await externalChat.capabilities(parsePairingTarget(parsed.target), signal);
|
|
93
|
+
case "chat_start":
|
|
94
|
+
return await externalChat.start(parsed.options, signal);
|
|
95
|
+
case "chat_send":
|
|
96
|
+
return await externalChat.send(parsed.options, signal);
|
|
97
|
+
case "chat_watch":
|
|
98
|
+
return await externalChat.watch(parsed.options, signal);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
const safe = safeError(error);
|
|
103
|
+
output.error(safe);
|
|
104
|
+
return safe.exitCode;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export function parseArguments(arguments_) {
|
|
108
|
+
const json = arguments_.includes("--json");
|
|
109
|
+
const args = arguments_.filter((argument) => argument !== "--json");
|
|
110
|
+
if (args.length === 0 || args[0] === "--help" || args[0] === "-h")
|
|
111
|
+
return { action: "help", json };
|
|
112
|
+
if (args[0] === "--version" || args[0] === "-v")
|
|
113
|
+
return { action: "version", json };
|
|
114
|
+
if (args[0] === "login") {
|
|
115
|
+
if (args.length === 1)
|
|
116
|
+
return { action: "login", json };
|
|
117
|
+
if (args.length === 2 && !args[1].startsWith("-")) {
|
|
118
|
+
return { action: "login", json, email: args[1] };
|
|
119
|
+
}
|
|
120
|
+
throw usageError();
|
|
121
|
+
}
|
|
122
|
+
if (args[0] === "logout" && args.length === 1)
|
|
123
|
+
return { action: "logout", json };
|
|
124
|
+
if (args[0] === "auth" && args[1] === "status" && args.length === 2) {
|
|
125
|
+
return { action: "auth_status", json };
|
|
126
|
+
}
|
|
127
|
+
if (args[0] === "servers" && args[1] === "list" && args.length === 2) {
|
|
128
|
+
return { action: "servers_list", json };
|
|
129
|
+
}
|
|
130
|
+
if (args[0] === "pair") {
|
|
131
|
+
if (args[1] === "status") {
|
|
132
|
+
if (args.length === 3 && !args[2].startsWith("-")) {
|
|
133
|
+
return { action: "pair_status", json, target: args[2] };
|
|
134
|
+
}
|
|
135
|
+
throw usageError();
|
|
136
|
+
}
|
|
137
|
+
const noOpen = args.includes("--no-open");
|
|
138
|
+
const positional = args
|
|
139
|
+
.slice(1)
|
|
140
|
+
.filter((argument) => argument !== "--no-open");
|
|
141
|
+
if (positional.length > 1 ||
|
|
142
|
+
positional.some((argument) => argument.startsWith("-"))) {
|
|
143
|
+
throw usageError();
|
|
144
|
+
}
|
|
145
|
+
const target = positional[0];
|
|
146
|
+
return { action: "pair", json, ...(target ? { target } : {}), noOpen };
|
|
147
|
+
}
|
|
148
|
+
if (args[0] === "chat" && args[1] === "capabilities" && args.length === 3) {
|
|
149
|
+
return { action: "chat_capabilities", json, target: args[2] };
|
|
150
|
+
}
|
|
151
|
+
if (args[0] === "chat" && args[1] === "start") {
|
|
152
|
+
const target = requiredPositional(args, 2);
|
|
153
|
+
const options = parseNamedOptions(args.slice(3), {
|
|
154
|
+
values: [
|
|
155
|
+
"--message",
|
|
156
|
+
"--provider",
|
|
157
|
+
"--model",
|
|
158
|
+
"--reasoning",
|
|
159
|
+
"--client-request-id",
|
|
160
|
+
],
|
|
161
|
+
booleans: ["--fast", "--no-fast"],
|
|
162
|
+
emptyValues: ["--reasoning"],
|
|
163
|
+
});
|
|
164
|
+
if (!options.values["--message"] ||
|
|
165
|
+
(options.flags.has("--fast") && options.flags.has("--no-fast")))
|
|
166
|
+
throw usageError();
|
|
167
|
+
return {
|
|
168
|
+
action: "chat_start",
|
|
169
|
+
json,
|
|
170
|
+
options: {
|
|
171
|
+
target: parsePairingTarget(target),
|
|
172
|
+
message: options.values["--message"],
|
|
173
|
+
...(options.values["--provider"]
|
|
174
|
+
? { provider: options.values["--provider"] }
|
|
175
|
+
: {}),
|
|
176
|
+
...(options.values["--model"]
|
|
177
|
+
? { model: options.values["--model"] }
|
|
178
|
+
: {}),
|
|
179
|
+
...(options.values["--reasoning"] !== undefined
|
|
180
|
+
? { reasoning: options.values["--reasoning"] }
|
|
181
|
+
: {}),
|
|
182
|
+
...(options.values["--client-request-id"]
|
|
183
|
+
? { clientRequestId: options.values["--client-request-id"] }
|
|
184
|
+
: {}),
|
|
185
|
+
...(options.flags.has("--fast") ? { fastMode: true } : {}),
|
|
186
|
+
...(options.flags.has("--no-fast") ? { fastMode: false } : {}),
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
if (args[0] === "chat" && args[1] === "send") {
|
|
191
|
+
const target = requiredPositional(args, 2);
|
|
192
|
+
const options = parseNamedOptions(args.slice(3), {
|
|
193
|
+
values: ["--session-id", "--message", "--client-request-id"],
|
|
194
|
+
booleans: [],
|
|
195
|
+
});
|
|
196
|
+
if (!options.values["--session-id"] || !options.values["--message"])
|
|
197
|
+
throw usageError();
|
|
198
|
+
return {
|
|
199
|
+
action: "chat_send",
|
|
200
|
+
json,
|
|
201
|
+
options: {
|
|
202
|
+
target: parsePairingTarget(target),
|
|
203
|
+
sessionId: options.values["--session-id"],
|
|
204
|
+
message: options.values["--message"],
|
|
205
|
+
...(options.values["--client-request-id"]
|
|
206
|
+
? { clientRequestId: options.values["--client-request-id"] }
|
|
207
|
+
: {}),
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
if (args[0] === "chat" && args[1] === "watch") {
|
|
212
|
+
const target = requiredPositional(args, 2);
|
|
213
|
+
const options = parseNamedOptions(args.slice(3), {
|
|
214
|
+
values: [
|
|
215
|
+
"--session-id",
|
|
216
|
+
"--request-id",
|
|
217
|
+
"--known-revision",
|
|
218
|
+
"--after-response-message-id",
|
|
219
|
+
],
|
|
220
|
+
booleans: [],
|
|
221
|
+
});
|
|
222
|
+
if (!options.values["--session-id"] || !options.values["--request-id"])
|
|
223
|
+
throw usageError();
|
|
224
|
+
return {
|
|
225
|
+
action: "chat_watch",
|
|
226
|
+
json,
|
|
227
|
+
options: {
|
|
228
|
+
target: parsePairingTarget(target),
|
|
229
|
+
sessionId: options.values["--session-id"],
|
|
230
|
+
requestId: options.values["--request-id"],
|
|
231
|
+
knownRevision: nonNegativeInteger(options.values["--known-revision"]),
|
|
232
|
+
responseCursor: nonNegativeInteger(options.values["--after-response-message-id"]),
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
throw usageError();
|
|
237
|
+
}
|
|
238
|
+
function requiredPositional(args, index) {
|
|
239
|
+
const value = args[index];
|
|
240
|
+
if (!value || value.startsWith("-"))
|
|
241
|
+
throw usageError();
|
|
242
|
+
return value;
|
|
243
|
+
}
|
|
244
|
+
function parseNamedOptions(args, allowed) {
|
|
245
|
+
const valueNames = new Set(allowed.values);
|
|
246
|
+
const booleanNames = new Set(allowed.booleans);
|
|
247
|
+
const values = {};
|
|
248
|
+
const flags = new Set();
|
|
249
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
250
|
+
const name = args[index];
|
|
251
|
+
if (booleanNames.has(name)) {
|
|
252
|
+
if (flags.has(name))
|
|
253
|
+
throw usageError();
|
|
254
|
+
flags.add(name);
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
if (!valueNames.has(name) || values[name] !== undefined)
|
|
258
|
+
throw usageError();
|
|
259
|
+
const value = args[index + 1];
|
|
260
|
+
if (value === undefined ||
|
|
261
|
+
(value === "" && !allowed.emptyValues?.includes(name)) ||
|
|
262
|
+
value.startsWith("--"))
|
|
263
|
+
throw usageError();
|
|
264
|
+
values[name] = value;
|
|
265
|
+
index += 1;
|
|
266
|
+
}
|
|
267
|
+
return { values, flags };
|
|
268
|
+
}
|
|
269
|
+
function nonNegativeInteger(value) {
|
|
270
|
+
if (value === undefined)
|
|
271
|
+
return 0;
|
|
272
|
+
const parsed = Number(value);
|
|
273
|
+
if (!Number.isSafeInteger(parsed) || parsed < 0)
|
|
274
|
+
throw usageError();
|
|
275
|
+
return parsed;
|
|
276
|
+
}
|
|
277
|
+
async function discoverTarget(broker, token, json, output, io, signal) {
|
|
278
|
+
if (!token) {
|
|
279
|
+
throw new TeamClawsError("login_or_server_required", "Sign in or provide a stable server identifier or canonical workspace address.", { exitCode: 4 });
|
|
280
|
+
}
|
|
281
|
+
const servers = (await broker.servers(token, signal)).filter((server) => server.pairing_ready);
|
|
282
|
+
if (servers.length === 0) {
|
|
283
|
+
throw new TeamClawsError("no_pairing_ready_workspaces", "No pairing-ready TeamClaws workspaces are available.", { exitCode: 4 });
|
|
284
|
+
}
|
|
285
|
+
if (servers.length === 1)
|
|
286
|
+
return { server_id: servers[0].server_id };
|
|
287
|
+
const interactive = io?.interactive ?? (process.stdin.isTTY && process.stdout.isTTY);
|
|
288
|
+
if (json || !interactive) {
|
|
289
|
+
throw new TeamClawsError("server_selection_required", "More than one workspace is available. Provide the stable server identifier.", { exitCode: 4 });
|
|
290
|
+
}
|
|
291
|
+
output.servers(servers);
|
|
292
|
+
const selected = await promptForServer(servers, io?.input ?? process.stdin, io?.stdout ?? process.stdout);
|
|
293
|
+
return { server_id: selected.server_id };
|
|
294
|
+
}
|
|
295
|
+
async function promptForServer(servers, input, output) {
|
|
296
|
+
const terminal = createInterface({
|
|
297
|
+
input,
|
|
298
|
+
output: output,
|
|
299
|
+
});
|
|
300
|
+
try {
|
|
301
|
+
const answer = (await terminal.question(`Choose a workspace (1-${servers.length}): `)).trim();
|
|
302
|
+
const index = Number(answer);
|
|
303
|
+
if (!Number.isInteger(index) || index < 1 || index > servers.length) {
|
|
304
|
+
throw new TeamClawsError("invalid_selection", "Choose one listed workspace number.", {
|
|
305
|
+
exitCode: 4,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
return servers[index - 1];
|
|
309
|
+
}
|
|
310
|
+
finally {
|
|
311
|
+
terminal.close();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function loginRequired() {
|
|
315
|
+
return new TeamClawsError("login_required", "Sign in to TeamClaws first.", {
|
|
316
|
+
exitCode: 3,
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
function usageError() {
|
|
320
|
+
return new TeamClawsError("invalid_command", "Run `teamclaws --help` for supported commands.", {
|
|
321
|
+
exitCode: 2,
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
export function helpText() {
|
|
325
|
+
return `TeamClaws ${PACKAGE_VERSION}\n\nUsage:\n teamclaws login [email] [--json]\n teamclaws auth status [--json]\n teamclaws logout [--json]\n teamclaws servers list [--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 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`;
|
|
326
|
+
}
|
|
327
|
+
//# sourceMappingURL=app.js.map
|
package/dist/app.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,kBAAkB,GAInB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAiB,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAgBrD,MAAM,CAAC,KAAK,UAAU,GAAG,CACvB,UAAoB,EACpB,eAAgC,EAAE,EAClC,MAAoB;IAEpB,IAAI,MAAuB,CAAC;IAC5B,IAAI,CAAC;QACH,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MA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