@mycadet/cli 0.12.6-dev.202610080102.d7d1bec → 0.12.6-dev.202610081023.3a27b77
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 +1 -1
- package/package.json +1 -1
- package/src/commands/login.ts +4 -4
- package/src/commands/ps.ts +1 -1
- package/src/commands/teleport.ts +4 -4
- package/src/commands/voice.ts +1 -1
- package/src/index.ts +2 -2
- package/src/lib/assistant-api-key-resolution.ts +1 -1
- package/src/lib/assistant-client.ts +7 -7
- package/src/lib/live-voice/connection.ts +2 -2
- package/src/lib/live-voice/tunnel.ts +5 -5
- package/src/lib/platform-client.ts +1 -1
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ cadet hatch [options]
|
|
|
57
57
|
|
|
58
58
|
- **`local`** -- Starts the local assistant and local gateway. Gateway source resolution order is: repo source tree, then installed `@mycadet/gateway` package.
|
|
59
59
|
- **`docker`** -- Starts the assistant, gateway, and credential service in Docker containers.
|
|
60
|
-
- **`cadet`** -- Hatches an assistant on
|
|
60
|
+
- **`cadet`** -- Hatches an assistant on Cadet Cloud.
|
|
61
61
|
- **`custom`** -- Recognized but not yet implemented.
|
|
62
62
|
|
|
63
63
|
#### Environment Variables
|
package/package.json
CHANGED
package/src/commands/login.ts
CHANGED
|
@@ -303,7 +303,7 @@ export async function login(): Promise<void> {
|
|
|
303
303
|
if (args.includes("--help") || args.includes("-h")) {
|
|
304
304
|
console.log("Usage: cadet login [--token <session-token>] [--force]");
|
|
305
305
|
console.log("");
|
|
306
|
-
console.log("Log in to
|
|
306
|
+
console.log("Log in to Cadet Cloud.");
|
|
307
307
|
console.log("");
|
|
308
308
|
console.log("By default, opens a browser window for authentication.");
|
|
309
309
|
console.log("Alternatively, pass a session token directly with --token.");
|
|
@@ -312,7 +312,7 @@ export async function login(): Promise<void> {
|
|
|
312
312
|
console.log("lockfile so they appear in `cadet ps`.");
|
|
313
313
|
console.log("");
|
|
314
314
|
console.log("Options:");
|
|
315
|
-
console.log(" --token <token> Session token from
|
|
315
|
+
console.log(" --token <token> Session token from Cadet Cloud");
|
|
316
316
|
console.log(
|
|
317
317
|
" --force, -f Re-authenticate even if already logged in",
|
|
318
318
|
);
|
|
@@ -435,7 +435,7 @@ export async function login(): Promise<void> {
|
|
|
435
435
|
webhookSecret: registration.webhook_secret,
|
|
436
436
|
});
|
|
437
437
|
if (allInjected) {
|
|
438
|
-
console.log("Injected
|
|
438
|
+
console.log("Injected cloud credentials into assistant.");
|
|
439
439
|
} else {
|
|
440
440
|
console.warn(
|
|
441
441
|
"Some credentials could not be injected into the assistant.",
|
|
@@ -484,7 +484,7 @@ export async function logout(): Promise<void> {
|
|
|
484
484
|
if (args.includes("--help") || args.includes("-h")) {
|
|
485
485
|
console.log("Usage: cadet logout");
|
|
486
486
|
console.log("");
|
|
487
|
-
console.log("Log out of
|
|
487
|
+
console.log("Log out of Cadet Cloud, remove the stored session token,");
|
|
488
488
|
console.log("and remove cloud-managed assistants from the local lockfile.");
|
|
489
489
|
process.exit(0);
|
|
490
490
|
}
|
package/src/commands/ps.ts
CHANGED
|
@@ -580,7 +580,7 @@ export async function listAllAssistants(verbose: boolean): Promise<void> {
|
|
|
580
580
|
? (msg) => console.log(` [verbose] ${msg}`)
|
|
581
581
|
: undefined;
|
|
582
582
|
|
|
583
|
-
// Decide
|
|
583
|
+
// Decide cloud login status FIRST, before touching the network. With no
|
|
584
584
|
// local token we never enter the platform fetch path — so unreachable-host
|
|
585
585
|
// errors from the org-ID/user lookups can't leak onto stderr ahead of the
|
|
586
586
|
// "Platform: not logged in" line.
|
package/src/commands/teleport.ts
CHANGED
|
@@ -1203,7 +1203,7 @@ function printImportSummary(result: ImportResponse): void {
|
|
|
1203
1203
|
|
|
1204
1204
|
/**
|
|
1205
1205
|
* After teleporting to a local/docker target, register the assistant with
|
|
1206
|
-
* the platform and inject fresh
|
|
1206
|
+
* the platform and inject fresh cloud credentials — mirroring the
|
|
1207
1207
|
* login flow. Non-fatal: failures are logged as warnings.
|
|
1208
1208
|
*/
|
|
1209
1209
|
async function tryInjectPlatformCredentials(
|
|
@@ -1211,7 +1211,7 @@ async function tryInjectPlatformCredentials(
|
|
|
1211
1211
|
): Promise<void> {
|
|
1212
1212
|
const token = readPlatformToken();
|
|
1213
1213
|
if (!token) {
|
|
1214
|
-
console.log(" Skipped
|
|
1214
|
+
console.log(" Skipped cloud credential injection (not logged in).");
|
|
1215
1215
|
return;
|
|
1216
1216
|
}
|
|
1217
1217
|
|
|
@@ -1269,7 +1269,7 @@ async function tryInjectPlatformCredentials(
|
|
|
1269
1269
|
if (allInjected) {
|
|
1270
1270
|
console.log(" Platform credentials injected.");
|
|
1271
1271
|
} else {
|
|
1272
|
-
console.warn(" Some
|
|
1272
|
+
console.warn(" Some cloud credentials could not be injected.");
|
|
1273
1273
|
}
|
|
1274
1274
|
} catch (err) {
|
|
1275
1275
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -1647,7 +1647,7 @@ export async function teleport(): Promise<void> {
|
|
|
1647
1647
|
bundlePlatformUrl,
|
|
1648
1648
|
);
|
|
1649
1649
|
|
|
1650
|
-
// After successful import, inject fresh
|
|
1650
|
+
// After successful import, inject fresh cloud credentials if the
|
|
1651
1651
|
// user is logged in — replaces the source's stale cadet:* credentials
|
|
1652
1652
|
// that were filtered during import.
|
|
1653
1653
|
if (fromCloud === "cadet") {
|
package/src/commands/voice.ts
CHANGED
|
@@ -54,7 +54,7 @@ DESCRIPTION:
|
|
|
54
54
|
is being spoken, ends the session.
|
|
55
55
|
|
|
56
56
|
Works with local, self-hosted, and Cadet cloud assistants. A cloud
|
|
57
|
-
assistant needs a
|
|
57
|
+
assistant needs a cloud login ('cadet login'); the session is
|
|
58
58
|
authorized per-connection from it.
|
|
59
59
|
|
|
60
60
|
EXAMPLES:
|
package/src/index.ts
CHANGED
|
@@ -108,8 +108,8 @@ function printHelp(): void {
|
|
|
108
108
|
console.log(" gateway Gateway management commands");
|
|
109
109
|
console.log(" hatch Create a new assistant instance");
|
|
110
110
|
console.log(" logs View logs from an assistant instance");
|
|
111
|
-
console.log(" login Log in to
|
|
112
|
-
console.log(" logout Log out of
|
|
111
|
+
console.log(" login Log in to Cadet Cloud");
|
|
112
|
+
console.log(" logout Log out of Cadet Cloud");
|
|
113
113
|
console.log(" message Send a message to a running assistant");
|
|
114
114
|
console.log(
|
|
115
115
|
" pair Print a pairing link and QR code for another device [beta]",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Resolve which assistant API key to inject into a running assistant.
|
|
3
3
|
*
|
|
4
4
|
* The one place that decides, for every flow that hands a local assistant its
|
|
5
|
-
*
|
|
5
|
+
* cloud credentials (`login`, `teleport`). Keeping the decision here means a
|
|
6
6
|
* rule about which stored key is usable holds in all of them at once.
|
|
7
7
|
*/
|
|
8
8
|
import {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* The auth scheme follows the assistant's topology, so callers never pick it.
|
|
15
15
|
* Platform-managed entries in particular have no local guardian token: they
|
|
16
16
|
* authenticate against the wildcard runtime proxy at
|
|
17
|
-
* `{platformUrl}/v1/assistants/<id>/<rest>` with the stored
|
|
17
|
+
* `{platformUrl}/v1/assistants/<id>/<rest>` with the stored cloud credential.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { isManagedCloud } from "./managed-cloud.js";
|
|
@@ -106,7 +106,7 @@ export class AssistantClient {
|
|
|
106
106
|
const platformManaged = !opts?.sessionToken && isManagedCloud(entry.cloud);
|
|
107
107
|
const platformHost = stripTrailingSlashes(entry.runtimeUrl);
|
|
108
108
|
|
|
109
|
-
// SECURITY: a
|
|
109
|
+
// SECURITY: a cloud credential is account-scoped, far broader than the
|
|
110
110
|
// per-assistant guardian JWT, so its origin is pinned to the host recorded in
|
|
111
111
|
// the lockfile. Honoring a URL override here would hand the caller's session
|
|
112
112
|
// token or `vak_` key to whatever host they named.
|
|
@@ -116,7 +116,7 @@ export class AssistantClient {
|
|
|
116
116
|
stripTrailingSlashes(opts.runtimeUrl) !== platformHost
|
|
117
117
|
) {
|
|
118
118
|
throw new Error(
|
|
119
|
-
`Refusing to send
|
|
119
|
+
`Refusing to send cloud credentials to '${opts.runtimeUrl}': ` +
|
|
120
120
|
`assistant '${entry.assistantId}' is hosted at ${platformHost}.`,
|
|
121
121
|
);
|
|
122
122
|
}
|
|
@@ -137,7 +137,7 @@ export class AssistantClient {
|
|
|
137
137
|
this.orgId = opts.orgId;
|
|
138
138
|
} else if (platformManaged) {
|
|
139
139
|
// Platform-managed: no guardian token exists locally, so authenticate with
|
|
140
|
-
// the stored
|
|
140
|
+
// the stored cloud credential. Resolved on first use because the org id
|
|
141
141
|
// behind it needs a network lookup.
|
|
142
142
|
this.token = undefined;
|
|
143
143
|
this.authMode = "platform";
|
|
@@ -166,7 +166,7 @@ export class AssistantClient {
|
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* Auth headers for the current mode. `authHeaders` picks the right scheme for
|
|
169
|
-
* the
|
|
169
|
+
* the cloud credential (`Authorization: Bearer` for `vak_` API keys,
|
|
170
170
|
* `X-Session-Token` + `Cadet-Organization-Id` for session tokens) and caches
|
|
171
171
|
* the org-id lookup, so the result is memoized per client and a failure is
|
|
172
172
|
* never cached.
|
|
@@ -343,8 +343,8 @@ export class AssistantClient {
|
|
|
343
343
|
|
|
344
344
|
// Reactive auto-refresh on a 401 for the guardian path only. Ephemeral
|
|
345
345
|
// (`--token`) and access-only sessions have no stored refresh credential and
|
|
346
|
-
// just see the original 401; session and
|
|
347
|
-
//
|
|
346
|
+
// just see the original 401; session and cloud credentials are managed by
|
|
347
|
+
// Cadet Cloud and are never refreshed here.
|
|
348
348
|
if (response.status === 401 && this.authMode === "guardian") {
|
|
349
349
|
const stored = loadGuardianToken(this._assistantId);
|
|
350
350
|
|
|
@@ -128,7 +128,7 @@ export async function resolveLiveVoiceConnection(
|
|
|
128
128
|
/**
|
|
129
129
|
* Resolve a live-voice connection to a platform-hosted assistant.
|
|
130
130
|
*
|
|
131
|
-
* The session token is the CLI's own
|
|
131
|
+
* The session token is the CLI's own cloud login, not anything specific to
|
|
132
132
|
* this assistant, so a missing one is a `cadet login` problem rather than an
|
|
133
133
|
* assistant problem and says so.
|
|
134
134
|
*
|
|
@@ -143,7 +143,7 @@ async function resolveCloudConnection(
|
|
|
143
143
|
if (!sessionToken) {
|
|
144
144
|
throw new LiveVoiceConnectionError(
|
|
145
145
|
`${formatAssistantReference(entry)} is a Cadet cloud assistant, which ` +
|
|
146
|
-
"needs a
|
|
146
|
+
"needs a cloud login. Run 'cadet login' and try again.",
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
|
|
@@ -159,7 +159,7 @@ export async function mintTunnelWsToken(args: {
|
|
|
159
159
|
} catch (err) {
|
|
160
160
|
throw new TunnelWsTokenError(
|
|
161
161
|
0,
|
|
162
|
-
`Could not reach
|
|
162
|
+
`Could not reach Cadet Cloud to authorize the voice session: ${
|
|
163
163
|
err instanceof Error ? err.message : String(err)
|
|
164
164
|
}`,
|
|
165
165
|
);
|
|
@@ -179,7 +179,7 @@ export async function mintTunnelWsToken(args: {
|
|
|
179
179
|
if (!token) {
|
|
180
180
|
throw new TunnelWsTokenError(
|
|
181
181
|
response.status,
|
|
182
|
-
"
|
|
182
|
+
"Cadet Cloud returned no voice session token.",
|
|
183
183
|
);
|
|
184
184
|
}
|
|
185
185
|
return token;
|
|
@@ -188,13 +188,13 @@ export async function mintTunnelWsToken(args: {
|
|
|
188
188
|
/** Turn a mint rejection into something the user can act on. */
|
|
189
189
|
function describeMintFailure(status: number): string {
|
|
190
190
|
if (status === 401) {
|
|
191
|
-
return "Not signed in to
|
|
191
|
+
return "Not signed in to Cadet Cloud. Run 'cadet login' and try again.";
|
|
192
192
|
}
|
|
193
193
|
if (status === 403) {
|
|
194
194
|
return "This account cannot open a voice session on that assistant. Check that it belongs to the organization you are signed in to.";
|
|
195
195
|
}
|
|
196
196
|
if (status === 404) {
|
|
197
|
-
return "
|
|
197
|
+
return "Cadet Cloud does not offer voice session tokens. It may be running an older release.";
|
|
198
198
|
}
|
|
199
|
-
return `
|
|
199
|
+
return `Cadet Cloud refused to authorize the voice session (HTTP ${status}).`;
|
|
200
200
|
}
|
|
@@ -508,7 +508,7 @@ export interface CredentialInjectionParams {
|
|
|
508
508
|
}
|
|
509
509
|
|
|
510
510
|
/**
|
|
511
|
-
* Inject
|
|
511
|
+
* Inject cloud credentials into a running assistant via the gateway,
|
|
512
512
|
* mirroring `LocalAssistantBootstrapService.injectKeyIntoAssistant` et al.
|
|
513
513
|
*
|
|
514
514
|
* Each credential is posted individually. Failures are collected but do
|