@skrr-ai/cli 0.1.50 → 0.1.52
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/dist/base-command.d.ts +7 -0
- package/dist/base-command.js +95 -8
- package/dist/commands/agents/chat.d.ts +14 -0
- package/dist/commands/agents/chat.js +37 -1
- package/dist/commands/agents/create.js +8 -4
- package/dist/commands/agents/show.d.ts +9 -0
- package/dist/commands/agents/show.js +53 -0
- package/dist/commands/agents/update.d.ts +32 -0
- package/dist/commands/agents/update.js +81 -9
- package/dist/commands/balance/show.d.ts +34 -0
- package/dist/commands/balance/show.js +92 -2
- package/dist/commands/commitments/doctor.d.ts +1 -0
- package/dist/commands/commitments/doctor.js +19 -4
- package/dist/commands/commitments/effective-policy.js +15 -1
- package/dist/commands/commitments/next-tick.js +12 -2
- package/dist/commands/commitments/preflight.js +10 -0
- package/dist/commands/commitments/show.js +11 -1
- package/dist/commands/context.js +2 -1
- package/dist/commands/daemon/config.d.ts +15 -0
- package/dist/commands/daemon/config.js +53 -0
- package/dist/commands/daemon/index.js +1 -0
- package/dist/commands/daemon/status.js +15 -1
- package/dist/commands/doctor.js +8 -1
- package/dist/commands/harnesses/models.d.ts +54 -0
- package/dist/commands/harnesses/models.js +100 -7
- package/dist/commands/harnesses/show.d.ts +11 -0
- package/dist/commands/harnesses/show.js +35 -0
- package/dist/commands/harnesses/update.d.ts +28 -1
- package/dist/commands/harnesses/update.js +73 -10
- package/dist/commands/login.d.ts +2 -1
- package/dist/commands/login.js +26 -7
- package/dist/commands/logout.js +3 -0
- package/dist/commands/machines/dedicated/show.js +25 -2
- package/dist/commands/outbox/list.d.ts +12 -1
- package/dist/commands/outbox/list.js +31 -2
- package/dist/commands/revoke-daemon.js +9 -0
- package/dist/commands/spaces/create.d.ts +1 -0
- package/dist/commands/spaces/create.js +17 -0
- package/dist/commands/spaces/show.js +5 -0
- package/dist/commands/spaces/update.d.ts +1 -0
- package/dist/commands/spaces/update.js +16 -0
- package/dist/commands/tasks/create.d.ts +6 -0
- package/dist/commands/tasks/create.js +31 -6
- package/dist/commands/tasks/show.js +45 -0
- package/dist/commands/tasks/start.d.ts +14 -0
- package/dist/commands/tasks/start.js +31 -1
- package/dist/commands/tasks/update.d.ts +1 -0
- package/dist/commands/tasks/update.js +29 -1
- package/dist/commands/tasks/upsert.d.ts +1 -0
- package/dist/commands/tasks/upsert.js +16 -0
- package/dist/commands/whoami.js +5 -3
- package/dist/lib/agent-config.d.ts +2 -0
- package/dist/lib/agent-config.js +14 -10
- package/dist/lib/agentic-stream.d.ts +88 -1
- package/dist/lib/agentic-stream.js +330 -9
- package/dist/lib/auth-core-init.d.ts +2 -10
- package/dist/lib/auth-core-init.js +20 -67
- package/dist/lib/auth-failure.d.ts +33 -0
- package/dist/lib/auth-failure.js +68 -0
- package/dist/lib/auth-storage.d.ts +24 -0
- package/dist/lib/auth-storage.js +342 -11
- package/dist/lib/cli-id.d.ts +22 -0
- package/dist/lib/cli-id.js +56 -0
- package/dist/lib/cli-identity.d.ts +49 -0
- package/dist/lib/cli-identity.js +159 -0
- package/dist/lib/commitments.d.ts +25 -1
- package/dist/lib/commitments.js +46 -1
- package/dist/lib/config.d.ts +17 -0
- package/dist/lib/config.js +15 -3
- package/dist/lib/daemonBroker.d.ts +37 -1
- package/dist/lib/daemonBroker.js +146 -22
- package/dist/lib/daemonBrokerRefusal.d.ts +51 -0
- package/dist/lib/daemonBrokerRefusal.js +127 -0
- package/dist/lib/dedicated-machines.d.ts +33 -2
- package/dist/lib/dedicated-machines.js +50 -1
- package/dist/lib/delegated-cli.js +20 -1
- package/dist/lib/exec-runtime-binary.d.ts +3 -1
- package/dist/lib/exec-runtime-binary.js +4 -2
- package/dist/lib/first-party-harness-broker.js +10 -5
- package/dist/lib/harnesses.d.ts +10 -0
- package/dist/lib/keychain.d.ts +39 -0
- package/dist/lib/keychain.js +228 -39
- package/dist/lib/label-ref.d.ts +34 -0
- package/dist/lib/label-ref.js +68 -1
- package/dist/lib/live-runtime-binary.d.ts +40 -0
- package/dist/lib/live-runtime-binary.js +193 -0
- package/dist/lib/login.d.ts +23 -0
- package/dist/lib/login.js +67 -21
- package/dist/lib/message-intent.js +3 -1
- package/dist/lib/oauthLogin.js +2 -8
- package/dist/lib/refresh.js +6 -2
- package/dist/lib/tasks.d.ts +20 -0
- package/dist/lib/tasks.js +87 -8
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.d.ts +2 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +26 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonToolApproval.d.ts +28 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonToolApproval.js +23 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +41 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +3 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +25 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loopbackHttp.d.ts +32 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loopbackHttp.js +268 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineId.d.ts +2 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineId.js +11 -10
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.d.ts +36 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +156 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.d.ts +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +8 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.d.ts +22 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +61 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.d.ts +2 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +25 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonToolApproval.d.ts +28 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonToolApproval.js +22 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +41 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +3 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +10 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loopbackHttp.d.ts +32 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loopbackHttp.js +257 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineId.d.ts +2 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineId.js +11 -10
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.d.ts +36 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +147 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.d.ts +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +8 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.d.ts +22 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +58 -1
- package/dist/node_modules/@skrr-ai/auth-core/package.json +21 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +3139 -3097
- package/oclif.manifest.json +28591 -28438
- package/package.json +1 -1
|
@@ -9,7 +9,6 @@ exports.ensureAuthCoreConfigured = ensureAuthCoreConfigured;
|
|
|
9
9
|
exports.prefetchCliAuth = prefetchCliAuth;
|
|
10
10
|
exports.waitForCliCredentialEnvelope = waitForCliCredentialEnvelope;
|
|
11
11
|
exports.__resetPrefetchCliAuthForTest = __resetPrefetchCliAuthForTest;
|
|
12
|
-
exports.shouldUseAccessTokenForEnrollment = shouldUseAccessTokenForEnrollment;
|
|
13
12
|
/**
|
|
14
13
|
* auth-core-init.ts — wire @skrr-ai/auth-core into the Sky CLI process.
|
|
15
14
|
*
|
|
@@ -31,8 +30,8 @@ exports.shouldUseAccessTokenForEnrollment = shouldUseAccessTokenForEnrollment;
|
|
|
31
30
|
* share the daemon's on-disk artifacts (~/.skrr/profiles/<p>/...)
|
|
32
31
|
* so a single physical machine has ONE device identity that `skrr`
|
|
33
32
|
* and `oversky` both consume.
|
|
34
|
-
* -
|
|
35
|
-
*
|
|
33
|
+
* - No server enrollment of the device key: that is the daemon login
|
|
34
|
+
* path's job (OSK-12063 — see `ensureCliAuthPrefetchStarted`).
|
|
36
35
|
*/
|
|
37
36
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
38
37
|
const node_path_1 = __importDefault(require("node:path"));
|
|
@@ -41,7 +40,6 @@ const auth_core_1 = require("@skrr-ai/auth-core");
|
|
|
41
40
|
const cred_envelope_1 = require("./cred-envelope");
|
|
42
41
|
const device_identity_1 = require("./device-identity");
|
|
43
42
|
const auth_storage_1 = require("./auth-storage");
|
|
44
|
-
const config_1 = require("./config");
|
|
45
43
|
function envFlag(name) {
|
|
46
44
|
const v = process.env[name];
|
|
47
45
|
return v === '1' || v === 'true' || v === 'TRUE';
|
|
@@ -135,7 +133,6 @@ const PREFETCH_TIMEOUT_MS = 5_000;
|
|
|
135
133
|
// with a 100–400 ms backoff (~20 s worst-case). Encrypted credentials get this
|
|
136
134
|
// larger, still-finite budget so lock contention cannot masquerade as logout.
|
|
137
135
|
const ENCRYPTED_CREDENTIAL_INIT_TIMEOUT_MS = 25_000;
|
|
138
|
-
const PREFETCH_ENROLL_MIN_TTL_MS = 5 * 60 * 1000;
|
|
139
136
|
let configured = false;
|
|
140
137
|
function ensureAuthCoreConfigured() {
|
|
141
138
|
if (configured)
|
|
@@ -247,31 +244,22 @@ function ensureCliAuthPrefetchStarted() {
|
|
|
247
244
|
try {
|
|
248
245
|
await envelopeInit;
|
|
249
246
|
await (0, device_identity_1.initDeviceIdentity)(DEFAULT_PROFILE);
|
|
250
|
-
//
|
|
251
|
-
// (
|
|
252
|
-
//
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
//
|
|
262
|
-
//
|
|
263
|
-
//
|
|
264
|
-
//
|
|
265
|
-
//
|
|
266
|
-
// reads the same value.
|
|
267
|
-
const machineUuid = (0, auth_core_1.ensureMachineDaemonId)();
|
|
268
|
-
(0, device_identity_1.enrollWithServer)({
|
|
269
|
-
serverUrl: cfg.baseURL,
|
|
270
|
-
accessToken: authBundle.token,
|
|
271
|
-
machineUuid,
|
|
272
|
-
}).catch(() => {
|
|
273
|
-
/* enrollment failure is non-fatal */
|
|
274
|
-
});
|
|
247
|
+
// The CLI deliberately does NOT enroll a device key with the server
|
|
248
|
+
// (OSK-12063). Enrollment pins the FIRST key presented on a machine's
|
|
249
|
+
// Daemon row, and every later refresh signed by a different key is
|
|
250
|
+
// refused. The CLI and the daemon of one profile can hold DIFFERENT
|
|
251
|
+
// keys (OSK-10314: the daemon stays on the legacy nested profile dir
|
|
252
|
+
// while consolidation is deferred), so a CLI enrollment could pin a
|
|
253
|
+
// key the daemon never signs with and lock the daemon out for good.
|
|
254
|
+
// Enrollment belongs to the daemon's own login path, which enrolls
|
|
255
|
+
// the key it will actually use.
|
|
256
|
+
//
|
|
257
|
+
// Until OSK-12063 this block did enroll, sending the minted UUIDv7
|
|
258
|
+
// from `~/.skrr/daemon.id` as `machineUuid`. The comment above it
|
|
259
|
+
// claimed that was the daemon's identifier too; it was not — the
|
|
260
|
+
// daemon sends the hardware UUID (`getMachineUuid()`), so every CLI
|
|
261
|
+
// enrollment 404'd DAEMON_NOT_FOUND and backed off. That 404 was the
|
|
262
|
+
// only thing keeping the pinning hazard above from firing.
|
|
275
263
|
}
|
|
276
264
|
catch (err) {
|
|
277
265
|
if (process.env.DEBUG) {
|
|
@@ -292,15 +280,9 @@ function ensureCliAuthPrefetchStarted() {
|
|
|
292
280
|
* `isCredEnvelopeActive()` to decide whether to wrap the private
|
|
293
281
|
* key on persist.
|
|
294
282
|
* 2. `initDeviceIdentity` second.
|
|
295
|
-
* 3. Server enrollment is fire-and-forget; only attempts if a current
|
|
296
|
-
* access token is already on disk (peek via the file backend slot
|
|
297
|
-
* so a missing token short-circuits cleanly without creating a
|
|
298
|
-
* whole CredentialResolver chain here).
|
|
299
283
|
*
|
|
300
|
-
* The
|
|
301
|
-
*
|
|
302
|
-
* spawn the auth-helper when the user is unauthenticated. Mirrors the
|
|
303
|
-
* daemon's `peekAuthAccessToken()` shape.
|
|
284
|
+
* The CLI never enrolls the device key with the server; see the comment
|
|
285
|
+
* in `ensureCliAuthPrefetchStarted` (OSK-12063).
|
|
304
286
|
*/
|
|
305
287
|
async function prefetchCliAuth() {
|
|
306
288
|
ensureCliAuthPrefetchStarted();
|
|
@@ -343,35 +325,6 @@ function __resetPrefetchCliAuthForTest() {
|
|
|
343
325
|
_credEnvelopeInitPromise = null;
|
|
344
326
|
_credEnvelopeInitStartedAt = 0;
|
|
345
327
|
}
|
|
346
|
-
/**
|
|
347
|
-
* Read the access token from keychain/file backends WITHOUT firing the
|
|
348
|
-
* full CredentialResolver chain. The full chain might prompt, spawn the
|
|
349
|
-
* auth-helper, or have other side effects we don't want during a
|
|
350
|
-
* prefetch-on-init pass.
|
|
351
|
-
*/
|
|
352
|
-
function peekStoredAuthBundle(expectedServerOrigin) {
|
|
353
|
-
try {
|
|
354
|
-
return (0, auth_storage_1.readFromBackend)(expectedServerOrigin).bundle;
|
|
355
|
-
}
|
|
356
|
-
catch {
|
|
357
|
-
return null;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
function shouldUseAccessTokenForEnrollment(bundle, nowMs = Date.now(), minTtlMs = PREFETCH_ENROLL_MIN_TTL_MS) {
|
|
361
|
-
if (!bundle?.token)
|
|
362
|
-
return false;
|
|
363
|
-
const expMs = accessExpiryMs(bundle);
|
|
364
|
-
if (expMs === undefined)
|
|
365
|
-
return true;
|
|
366
|
-
return expMs - nowMs > minTtlMs;
|
|
367
|
-
}
|
|
368
|
-
function accessExpiryMs(bundle) {
|
|
369
|
-
if (typeof bundle.expiresAt === 'number' && Number.isFinite(bundle.expiresAt)) {
|
|
370
|
-
return bundle.expiresAt;
|
|
371
|
-
}
|
|
372
|
-
const exp = (0, auth_core_1.decodeJwtExpiry)(bundle.token);
|
|
373
|
-
return typeof exp === 'number' && Number.isFinite(exp) ? exp * 1000 : undefined;
|
|
374
|
-
}
|
|
375
328
|
// Eager-configure on first import. Cheap and avoids ordering pitfalls in
|
|
376
329
|
// any future command that calls auth-core helpers from outside a Command.
|
|
377
330
|
ensureAuthCoreConfigured();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* auth-failure.ts — say WHY a request was refused on authentication (OSK-12116).
|
|
3
|
+
*
|
|
4
|
+
* A 401 reaches the CLI after its own renewal has already failed: the access
|
|
5
|
+
* token expired, the refresh was refused, and the retry went out with the dead
|
|
6
|
+
* token. The server's answer to that retry is `TOKEN_EXPIRED`, which is true and
|
|
7
|
+
* useless — the expiry is routine, the refusal to RENEW is the fault, and it was
|
|
8
|
+
* visible only as an `[auth-core warn]` line on stderr.
|
|
9
|
+
*
|
|
10
|
+
* auth-core latches every permanent refresh refusal (`needs-reauth.json`, the
|
|
11
|
+
* same record `skrr whoami` prints as "Refresh state"). This module reads that
|
|
12
|
+
* latch and turns it into the sentence the error should have carried.
|
|
13
|
+
*/
|
|
14
|
+
export interface RefreshRefusal {
|
|
15
|
+
/** Permanent reason code the refresh latched (`REFRESH_INVALID`, `SESSION_REVOKED`, …). */
|
|
16
|
+
reason?: string;
|
|
17
|
+
/** The server's own message for the refusal, when auth-core recorded one. */
|
|
18
|
+
message?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface DescribedAuthFailure {
|
|
21
|
+
message: string;
|
|
22
|
+
/** The code a script should key on: the refresh refusal when known. */
|
|
23
|
+
code: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Explain one refresh refusal in terms of what the reader can do about it.
|
|
27
|
+
* Returns null when there is no latched refusal, so the caller keeps its
|
|
28
|
+
* generic wording rather than inventing a cause.
|
|
29
|
+
*/
|
|
30
|
+
export declare function describeRefreshRefusal(refusal: RefreshRefusal | null | undefined, opts: {
|
|
31
|
+
bin: string;
|
|
32
|
+
cliId?: string;
|
|
33
|
+
}): DescribedAuthFailure | null;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* auth-failure.ts — say WHY a request was refused on authentication (OSK-12116).
|
|
4
|
+
*
|
|
5
|
+
* A 401 reaches the CLI after its own renewal has already failed: the access
|
|
6
|
+
* token expired, the refresh was refused, and the retry went out with the dead
|
|
7
|
+
* token. The server's answer to that retry is `TOKEN_EXPIRED`, which is true and
|
|
8
|
+
* useless — the expiry is routine, the refusal to RENEW is the fault, and it was
|
|
9
|
+
* visible only as an `[auth-core warn]` line on stderr.
|
|
10
|
+
*
|
|
11
|
+
* auth-core latches every permanent refresh refusal (`needs-reauth.json`, the
|
|
12
|
+
* same record `skrr whoami` prints as "Refresh state"). This module reads that
|
|
13
|
+
* latch and turns it into the sentence the error should have carried.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.describeRefreshRefusal = describeRefreshRefusal;
|
|
17
|
+
/**
|
|
18
|
+
* Explain one refresh refusal in terms of what the reader can do about it.
|
|
19
|
+
* Returns null when there is no latched refusal, so the caller keeps its
|
|
20
|
+
* generic wording rather than inventing a cause.
|
|
21
|
+
*/
|
|
22
|
+
function describeRefreshRefusal(refusal, opts) {
|
|
23
|
+
if (!refusal?.reason)
|
|
24
|
+
return null;
|
|
25
|
+
const { bin } = opts;
|
|
26
|
+
const code = refusal.reason;
|
|
27
|
+
const said = refusal.message ? ` (${code}: ${refusal.message})` : ` (${code})`;
|
|
28
|
+
const relogin = `Run \`${bin} login\` to sign in again.`;
|
|
29
|
+
const message = refusal.message ?? '';
|
|
30
|
+
// The row the stored refresh token belongs to was minted for a different CLI
|
|
31
|
+
// identity than the one this config presents. The keychain slot is keyed by
|
|
32
|
+
// profile, while the CLI ID lives in the config directory — so a second skrr
|
|
33
|
+
// configuration on this machine (a different HOME or config dir sharing the
|
|
34
|
+
// same login Keychain) can write this profile's credential under its own ID.
|
|
35
|
+
// Observed: a token minted for `cli_devin_dogfood` sitting in the default
|
|
36
|
+
// profile's slot. Since OSK-12135 the slot is namespaced by config root and a
|
|
37
|
+
// read refuses a bundle bound to another cliId before presenting it, so this
|
|
38
|
+
// is now reached only when the server's binding disagrees with a token that
|
|
39
|
+
// carries no readable `did`.
|
|
40
|
+
if (/bound to a different daemon/i.test(message)) {
|
|
41
|
+
return {
|
|
42
|
+
code,
|
|
43
|
+
message: `This profile's stored sign-in could not be renewed${said}. The credential in its ` +
|
|
44
|
+
`Keychain slot was issued to a different CLI identity than this one` +
|
|
45
|
+
`${opts.cliId ? ` (${opts.cliId})` : ''} — usually another skrr configuration on this ` +
|
|
46
|
+
`machine (a different HOME or config directory) signed in and wrote over it. ${relogin}`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (code === 'SESSION_REVOKED') {
|
|
50
|
+
return {
|
|
51
|
+
code,
|
|
52
|
+
message: `This sign-in was revoked${said}. Signing out elsewhere revokes it, and so does ` +
|
|
53
|
+
`revoking a daemon that brokered it (\`${bin} login\` without a browser signs in ` +
|
|
54
|
+
`through this machine's daemon). ${relogin}`,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (code === 'REFRESH_REUSED') {
|
|
58
|
+
return {
|
|
59
|
+
code,
|
|
60
|
+
message: `This sign-in was ended because its refresh token was presented twice${said}; the ` +
|
|
61
|
+
`server treats that as possible theft and revokes the whole family. ${relogin}`,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
code,
|
|
66
|
+
message: `This sign-in could not be renewed${said}. ${relogin}`,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -6,14 +6,33 @@ export interface AuthBundle {
|
|
|
6
6
|
refreshExpiresAt?: number;
|
|
7
7
|
/** Normalized API origin that issued this access/refresh pair. */
|
|
8
8
|
serverOrigin?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The config that wrote this bundle, as stored. Filled on write from the
|
|
11
|
+
* current config; callers never need to set it.
|
|
12
|
+
*/
|
|
13
|
+
owner?: CredentialOwner;
|
|
14
|
+
}
|
|
15
|
+
/** Which skrr config a credential belongs to. */
|
|
16
|
+
export interface CredentialOwner {
|
|
17
|
+
/** Resolved config root (`~/.skrr`, or the `SKRR_CONFIG_DIR` override). */
|
|
18
|
+
configRoot?: string;
|
|
19
|
+
/** The CLI identity the server bound the refresh family to. */
|
|
20
|
+
cliId?: string;
|
|
9
21
|
}
|
|
10
22
|
export type CredentialOriginStatus = 'none' | 'unchecked' | 'matched' | 'unbound' | 'mismatch';
|
|
23
|
+
/** `foreign`: the stored bundle belongs to another skrr config and was not used. */
|
|
24
|
+
export type CredentialOwnerStatus = 'foreign';
|
|
11
25
|
export interface ReadResult {
|
|
12
26
|
bundle: AuthBundle | null;
|
|
13
27
|
backend: AuthBackend;
|
|
14
28
|
originStatus?: CredentialOriginStatus;
|
|
15
29
|
storedServerOrigin?: string;
|
|
16
30
|
expectedServerOrigin?: string;
|
|
31
|
+
ownerStatus?: CredentialOwnerStatus;
|
|
32
|
+
/** For `foreign`: who the stored bundle belongs to. */
|
|
33
|
+
storedOwner?: CredentialOwner;
|
|
34
|
+
/** For `foreign`: who this process is. */
|
|
35
|
+
expectedOwner?: CredentialOwner;
|
|
17
36
|
}
|
|
18
37
|
export interface WriteOptions {
|
|
19
38
|
/** Bind/overwrite the bundle's issuing origin. Invalid origins are rejected. */
|
|
@@ -47,6 +66,11 @@ export declare function deleteFileBackend(): void;
|
|
|
47
66
|
* function returns whatever is persisted.
|
|
48
67
|
*/
|
|
49
68
|
export declare function readFromBackend(expectedServerOrigin?: string): ReadResult;
|
|
69
|
+
/**
|
|
70
|
+
* One sentence naming whose credential was refused and why, for the surfaces
|
|
71
|
+
* that explain an absent sign-in (BaseCommand, `skrr doctor`).
|
|
72
|
+
*/
|
|
73
|
+
export declare function describeForeignCredential(result: ReadResult): string | null;
|
|
50
74
|
export declare function writeToBackend(bundle: AuthBundle, options?: WriteOptions): AuthBackend;
|
|
51
75
|
/**
|
|
52
76
|
* Clear both backends. Called on `skrr logout` (and internally during
|