teamclaws 2.0.9 → 2.0.10
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 +16 -1
- package/dist/broker.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/output.js +30 -0
- package/dist/validation.js +20 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -124,7 +124,7 @@ request. Test a required-yield environment separately if automatic wakeup is
|
|
|
124
124
|
used. Local CLI tests establish process behavior, not automatic loading or
|
|
125
125
|
compliance in every agent environment.
|
|
126
126
|
|
|
127
|
-
`servers list` requests `GET /api/cli/v1/servers/?include_inventory=1&include_description=1&include_editable_metadata=1`. Updated
|
|
127
|
+
`servers list` requests `GET /api/cli/v1/servers/?include_inventory=1&include_description=1&include_editable_metadata=1&include_subscription=1`. Updated
|
|
128
128
|
brokers return `servers` and `workspace_count`: the count of all non-deleted
|
|
129
129
|
owned and eligible shared workspaces, including those without a hostname yet.
|
|
130
130
|
Individual server entries retain aliases, stable IDs, status and `pairing_ready`.
|
|
@@ -135,6 +135,21 @@ fallback display name) and `can_edit_metadata`. Older brokers may omit these.
|
|
|
135
135
|
Older brokers may omit the count; the CLI reports it as null and never infers
|
|
136
136
|
an empty account from an empty filtered list.
|
|
137
137
|
|
|
138
|
+
Subscription inventory (2026-11-04) adds optional `tier_name`, `is_free`, and
|
|
139
|
+
`free_expires_at` fields. Null values mean no subscription information or no
|
|
140
|
+
free expiration deadline, as applicable. The CLI displays the tier and free
|
|
141
|
+
deadline and starts warning seven days before free access expires, including
|
|
142
|
+
an expired warning at or after the deadline. JSON `servers_list` events include
|
|
143
|
+
the subscription fields and a `warnings` array with server ID, warning code,
|
|
144
|
+
deadline, and message. Warnings are evaluated when inventory is displayed;
|
|
145
|
+
there is no background polling.
|
|
146
|
+
|
|
147
|
+
`include_subscription=1` preserves compatibility with older clients whose list
|
|
148
|
+
validators reject extra fields. This compatibility opt-in can be retired when
|
|
149
|
+
support for those clients ends. This CLI accepts older responses without the
|
|
150
|
+
subscription fields and ignores unknown inventory and server-entry fields,
|
|
151
|
+
while continuing to validate every recognized field it consumes.
|
|
152
|
+
|
|
138
153
|
The `servers_list` event adds `workspace_count` and `discovery_state`:
|
|
139
154
|
`no_workspaces` only for a verified count of zero, `ready` when any listed
|
|
140
155
|
workspace is pairing-ready, `not_ready` when workspaces exist but none is ready,
|
package/dist/broker.js
CHANGED
|
@@ -17,7 +17,7 @@ export class BrokerClient {
|
|
|
17
17
|
return normalizedDeviceName(this.deviceName());
|
|
18
18
|
}
|
|
19
19
|
async servers(signal) {
|
|
20
|
-
const url = `${API_BASE}servers/?include_inventory=1&include_description=1&include_editable_metadata=1`;
|
|
20
|
+
const url = `${API_BASE}servers/?include_inventory=1&include_description=1&include_editable_metadata=1&include_subscription=1`;
|
|
21
21
|
const response = await requestJson(this.fetcher, url, {
|
|
22
22
|
headers: await this.issuerHeaders("GET", url),
|
|
23
23
|
...(signal ? { signal } : {}),
|
package/dist/constants.js
CHANGED
package/dist/output.js
CHANGED
|
@@ -84,11 +84,33 @@ export class Output {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
servers(servers, workspaceCount) {
|
|
87
|
+
const now = Date.now();
|
|
88
|
+
const warnings = servers.flatMap((server) => {
|
|
89
|
+
if (server.is_free !== true || !server.free_expires_at)
|
|
90
|
+
return [];
|
|
91
|
+
const remaining = Date.parse(server.free_expires_at) - now;
|
|
92
|
+
if (remaining > 7 * 24 * 60 * 60 * 1_000)
|
|
93
|
+
return [];
|
|
94
|
+
const expired = remaining <= 0;
|
|
95
|
+
return [
|
|
96
|
+
{
|
|
97
|
+
server_id: server.server_id,
|
|
98
|
+
code: expired
|
|
99
|
+
? "free_subscription_expired"
|
|
100
|
+
: "free_subscription_expiring",
|
|
101
|
+
free_expires_at: server.free_expires_at,
|
|
102
|
+
message: expired
|
|
103
|
+
? `Free access for ${server.alias} expired on ${server.free_expires_at}.`
|
|
104
|
+
: `Free access for ${server.alias} expires on ${server.free_expires_at} (within 7 days).`,
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
});
|
|
87
108
|
this.event({
|
|
88
109
|
schema_version: OUTPUT_SCHEMA_VERSION,
|
|
89
110
|
event: "servers_list",
|
|
90
111
|
status: "success",
|
|
91
112
|
servers,
|
|
113
|
+
warnings,
|
|
92
114
|
workspace_count: workspaceCount ?? null,
|
|
93
115
|
discovery_state: workspaceCount === 0
|
|
94
116
|
? "no_workspaces"
|
|
@@ -109,6 +131,14 @@ export class Output {
|
|
|
109
131
|
this.stdout.write(`${index + 1}. ${server.alias} — ${server.server_id} — ${server.workspace_url} — ${server.pairing_ready ? "ready to pair" : "not ready to pair"}\n`);
|
|
110
132
|
if (server.description)
|
|
111
133
|
this.stdout.write(` ${server.description}\n`);
|
|
134
|
+
if (server.tier_name)
|
|
135
|
+
this.stdout.write(` Tier: ${server.tier_name}\n`);
|
|
136
|
+
if (server.is_free === true) {
|
|
137
|
+
this.stdout.write(` Free access${server.free_expires_at ? `; expires ${server.free_expires_at}` : ""}\n`);
|
|
138
|
+
}
|
|
139
|
+
const warning = warnings.find((item) => item.server_id === server.server_id);
|
|
140
|
+
if (warning)
|
|
141
|
+
this.stdout.write(` Warning: ${warning.message}\n`);
|
|
112
142
|
});
|
|
113
143
|
}
|
|
114
144
|
}
|
package/dist/validation.js
CHANGED
|
@@ -342,7 +342,6 @@ export function parseServersResponse(value) {
|
|
|
342
342
|
exitCode: 9,
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
|
-
assertExactKeys(value, ["servers"], ["workspace_count"], "server list");
|
|
346
345
|
if (!Array.isArray(value.servers)) {
|
|
347
346
|
throw new TeamClawsError("invalid_response", "TeamClaws returned an invalid server list.", {
|
|
348
347
|
exitCode: 9,
|
|
@@ -359,7 +358,6 @@ export function parseServersResponse(value) {
|
|
|
359
358
|
exitCode: 9,
|
|
360
359
|
});
|
|
361
360
|
}
|
|
362
|
-
assertExactKeys(server, ["id", "alias", "workspace_url", "status", "pairing_ready"], ["description", "custom_alias", "can_edit_metadata"], "server");
|
|
363
361
|
if (typeof server.pairing_ready !== "boolean") {
|
|
364
362
|
throw new TeamClawsError("invalid_response", "TeamClaws returned an invalid server.", {
|
|
365
363
|
exitCode: 9,
|
|
@@ -376,8 +374,28 @@ export function parseServersResponse(value) {
|
|
|
376
374
|
typeof server.can_edit_metadata !== "boolean")) {
|
|
377
375
|
throw new TeamClawsError("invalid_response", "TeamClaws returned invalid server editing permissions.", { exitCode: 9 });
|
|
378
376
|
}
|
|
377
|
+
if (server.is_free !== undefined &&
|
|
378
|
+
server.is_free !== null &&
|
|
379
|
+
typeof server.is_free !== "boolean") {
|
|
380
|
+
throw new TeamClawsError("invalid_response", "TeamClaws returned an invalid free subscription status.", { exitCode: 9 });
|
|
381
|
+
}
|
|
379
382
|
return {
|
|
380
383
|
server_id: normalizeUuid(server.id),
|
|
384
|
+
...(server.tier_name !== undefined
|
|
385
|
+
? {
|
|
386
|
+
tier_name: server.tier_name === null
|
|
387
|
+
? null
|
|
388
|
+
: requireString(server.tier_name, "subscription tier", 200),
|
|
389
|
+
}
|
|
390
|
+
: {}),
|
|
391
|
+
...(server.is_free !== undefined ? { is_free: server.is_free } : {}),
|
|
392
|
+
...(server.free_expires_at !== undefined
|
|
393
|
+
? {
|
|
394
|
+
free_expires_at: server.free_expires_at === null
|
|
395
|
+
? null
|
|
396
|
+
: requireIsoDate(server.free_expires_at, "free subscription expiry"),
|
|
397
|
+
}
|
|
398
|
+
: {}),
|
|
381
399
|
alias: requireString(server.alias, "server alias", 200),
|
|
382
400
|
...(typeof server.description === "string"
|
|
383
401
|
? { description: server.description }
|