@thermai/flightdeck-cli 0.1.0-pilot.3 → 0.1.0-pilot.4
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 +25 -9
- package/dist/index.js +24 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,10 +18,24 @@ Proprietary terms in `LICENSE` permit redistribution of unchanged official
|
|
|
18
18
|
releases. Internal service qualification is still in progress; package
|
|
19
19
|
availability does not open partner onboarding.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
**`0.1.0-pilot.3`** was published through GitHub Actions on 8 September 2026,
|
|
22
|
+
including complete log pagination and concise authentication errors. Its
|
|
23
|
+
anonymous Node 22 install and packaged dry run passed; `next` selects this
|
|
24
|
+
version. Use the operator-approved exact version for a recorded rehearsal.
|
|
25
|
+
|
|
26
|
+
**Candidate `0.1.0-pilot.4`** adds customer credits and requires a backend
|
|
27
|
+
advertising `X-Flightdeck-Accounting: credits-v1`. It is not published merely
|
|
28
|
+
by merging this change. After the coordinated release, upgrade with the install
|
|
29
|
+
command below before accessing account/job data. An incompatible backend is
|
|
30
|
+
rejected before job submission; login and credential revocation do not require
|
|
31
|
+
the accounting contract. See the
|
|
32
|
+
[operator rollout checklist](../docs/runbooks/customer-credits-rollout.md).
|
|
33
|
+
|
|
34
|
+
Members and organization administrators receive whole-credit balances,
|
|
35
|
+
estimates and actual customer charges, without provider-cost information.
|
|
36
|
+
Platform administrators retain their authorized monetary API fields. Credits
|
|
37
|
+
are not GPU-hours; consumption depends on the selected hardware/provider and
|
|
38
|
+
the accepted job pricing. Existing limits and customer charge caps still apply.
|
|
25
39
|
|
|
26
40
|
## Installation and login
|
|
27
41
|
|
|
@@ -57,8 +71,10 @@ credential management can revoke an individual workstation as well.
|
|
|
57
71
|
|
|
58
72
|
`--name` labels a credential, not a local account profile. There is one saved
|
|
59
73
|
login per OS user. If already logged in, use `whoami` to inspect it; `login`
|
|
60
|
-
refuses to replace it.
|
|
61
|
-
|
|
74
|
+
refuses to replace it. Use a separate OS user to preserve an operator's working
|
|
75
|
+
credential, or explicitly choose logout/re-login on the same workstation.
|
|
76
|
+
Logging out revokes that saved CLI credential; it does not delete the account or
|
|
77
|
+
its roles. A later login creates a new credential.
|
|
62
78
|
|
|
63
79
|
## Pilot quick-start
|
|
64
80
|
|
|
@@ -148,7 +164,7 @@ agreed pilot handoff; this client does not promise unattended support.
|
|
|
148
164
|
|
|
149
165
|
### Reading logs completely
|
|
150
166
|
|
|
151
|
-
|
|
167
|
+
From `0.1.0-pilot.3` (containing the #99 pagination fix), `flightdeck logs`
|
|
152
168
|
drains all pages in the current stored-log snapshot, then returns. For a running
|
|
153
169
|
job it may append one current live tail after the stored pages. `--follow`
|
|
154
170
|
drains those pages immediately, then polls every two seconds until the job is
|
|
@@ -158,13 +174,13 @@ the beginning; stdout/stderr retain their respective output streams.
|
|
|
158
174
|
**Rollout order:** deploy and verify the pagination-capable backend before
|
|
159
175
|
releasing/upgrading this CLI. A backend without the `has_more` response field
|
|
160
176
|
produces an explicit compatibility error and exit status 1, not a silently
|
|
161
|
-
partial read.
|
|
177
|
+
partial read. Older `0.1.0-pilot.2` installations do not contain this fix;
|
|
162
178
|
merging source alone neither replaces that immutable package nor publishes a
|
|
163
179
|
new version. Older non-following clients still need upgrading for full paging.
|
|
164
180
|
|
|
165
181
|
### Error handling and support
|
|
166
182
|
|
|
167
|
-
The
|
|
183
|
+
The CLI exits with status 1 on command failure. Expected authentication,
|
|
168
184
|
network and HTTP failures have concise diagnostics instead of a Node stack.
|
|
169
185
|
An already-configured login leaves the saved credential unchanged; a failed
|
|
170
186
|
logout/revocation retains it so you can retry. `logout --local` deliberately
|
package/dist/index.js
CHANGED
|
@@ -73,6 +73,8 @@ Diagnostic: ${details.join("; ") || "unknown error type"}`;
|
|
|
73
73
|
// src/client.ts
|
|
74
74
|
var DEFAULT_API_URL = "https://api.flightdeck.thermai.uk";
|
|
75
75
|
var CONFIG_PATH = join(homedir(), ".flightdeck", "config.json");
|
|
76
|
+
var ACCOUNTING_HEADER = "X-Flightdeck-Accounting";
|
|
77
|
+
var ACCOUNTING_CONTRACT = "credits-v1";
|
|
76
78
|
function normalizeApiUrl(value) {
|
|
77
79
|
let url;
|
|
78
80
|
try {
|
|
@@ -167,13 +169,30 @@ async function publicApiRequest(apiUrl, method, path, body) {
|
|
|
167
169
|
async function apiRequest(method, path, body) {
|
|
168
170
|
const config = loadConfig();
|
|
169
171
|
const headers = {
|
|
170
|
-
Authorization: `Bearer ${config.api_key}
|
|
172
|
+
Authorization: `Bearer ${config.api_key}`,
|
|
173
|
+
[ACCOUNTING_HEADER]: ACCOUNTING_CONTRACT
|
|
171
174
|
};
|
|
172
|
-
|
|
175
|
+
if (method === "POST" && (path === "/jobs/submit" || path === "/flights")) {
|
|
176
|
+
const health = await request(endpoint(config.api_url, "/health"), { method: "GET" });
|
|
177
|
+
assertAccountingContract(health);
|
|
178
|
+
if (!health.ok) throw new CliError("The Flightdeck API is not ready. No job was submitted.");
|
|
179
|
+
}
|
|
180
|
+
const response = await request(endpoint(config.api_url, path), {
|
|
173
181
|
method,
|
|
174
182
|
headers,
|
|
175
183
|
body: requestBody(body, headers)
|
|
176
184
|
});
|
|
185
|
+
if (path !== "/auth/credential/revoke" && (response.ok || response.status === 402)) assertAccountingContract(response);
|
|
186
|
+
if (response.status === 409) {
|
|
187
|
+
const body2 = await response.clone().json().catch(() => ({}));
|
|
188
|
+
if (body2.error === "accounting_client_upgrade_required") throw new CliError("Update the Flightdeck CLI to use credits accounting.");
|
|
189
|
+
}
|
|
190
|
+
return response;
|
|
191
|
+
}
|
|
192
|
+
function assertAccountingContract(response) {
|
|
193
|
+
if (response.headers.get(ACCOUNTING_HEADER) !== ACCOUNTING_CONTRACT) {
|
|
194
|
+
throw new CliError("The API does not support this CLI's credits contract yet. Contact your ThermAI operator. No accounting amounts were displayed.");
|
|
195
|
+
}
|
|
177
196
|
}
|
|
178
197
|
async function request(url, options) {
|
|
179
198
|
try {
|
|
@@ -356,7 +375,7 @@ async function submit(entrypoint, options) {
|
|
|
356
375
|
Flight submitted successfully!`);
|
|
357
376
|
console.log(` Flight ID: ${body.flight_id}`);
|
|
358
377
|
console.log(` Status: ${body.status}`);
|
|
359
|
-
console.log(` Est.
|
|
378
|
+
console.log(` Est. credits: ${body.estimated_credits}`);
|
|
360
379
|
console.log(` Queue position: ${body.position_in_queue}`);
|
|
361
380
|
console.log(`
|
|
362
381
|
Track with: flightdeck status ${body.flight_id}`);
|
|
@@ -964,7 +983,8 @@ async function status(flightId) {
|
|
|
964
983
|
if (body.completed_at) console.log(` Finished: ${body.completed_at}`);
|
|
965
984
|
if (body.exit_code != null) console.log(` Exit: ${body.exit_code}`);
|
|
966
985
|
if (body.error_message) console.log(` Error: ${body.error_message}`);
|
|
967
|
-
if (body.
|
|
986
|
+
if (body.charge_credits != null) console.log(` Charged: ${body.charge_credits} credits`);
|
|
987
|
+
if (body.cost_pence != null) console.log(` Provider cost: ${body.cost_pence}p`);
|
|
968
988
|
}
|
|
969
989
|
|
|
970
990
|
// src/log-reader.ts
|