@skrr-ai/cli 0.1.142 → 0.1.144
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 +8 -0
- package/dist/base-command.d.ts +4 -2
- package/dist/base-command.js +46 -13
- package/dist/commands/agenda/trigger/create.js +4 -2
- package/dist/commands/agenda/trigger/list.js +7 -7
- package/dist/commands/agent/message/approve.d.ts +17 -0
- package/dist/commands/agent/message/approve.js +72 -0
- package/dist/commands/agent/message/decline.d.ts +17 -0
- package/dist/commands/agent/message/decline.js +72 -0
- package/dist/commands/agent/message/pending.d.ts +18 -0
- package/dist/commands/agent/message/pending.js +79 -0
- package/dist/commands/agents/always-on/disable.js +9 -1
- package/dist/commands/agents/always-on/enable.js +9 -1
- package/dist/commands/agents/always-on/status.js +14 -1
- package/dist/commands/agents/create.js +10 -1
- package/dist/commands/agents/delete.d.ts +51 -0
- package/dist/commands/agents/delete.js +163 -2
- package/dist/commands/agents/intuitions/list.js +1 -1
- package/dist/commands/agents/plan-day.d.ts +39 -7
- package/dist/commands/agents/plan-day.js +254 -65
- package/dist/commands/agents/proactive-audit.d.ts +22 -0
- package/dist/commands/agents/proactive-audit.js +86 -0
- package/dist/commands/agents/schedule-overview.d.ts +7 -0
- package/dist/commands/agents/schedule-overview.js +43 -5
- package/dist/commands/agents/schedule-trace.js +30 -19
- package/dist/commands/agents/spawn.d.ts +51 -0
- package/dist/commands/agents/spawn.js +212 -9
- package/dist/commands/agents/todos/cancel.js +3 -0
- package/dist/commands/agents/todos/edit.js +1 -1
- package/dist/commands/agents/todos/list.d.ts +5 -0
- package/dist/commands/agents/todos/list.js +19 -5
- package/dist/commands/agents/triggers/create.js +1 -1
- package/dist/commands/agents/triggers/policy.js +7 -0
- package/dist/commands/agents/triggers/update.js +1 -1
- package/dist/commands/commitments/create.js +13 -3
- package/dist/commands/commitments/preflight.js +31 -5
- package/dist/commands/daemon/index.js +1 -0
- package/dist/commands/daemon/logs.d.ts +8 -1
- package/dist/commands/daemon/logs.js +32 -22
- package/dist/commands/daemon/profile.d.ts +15 -0
- package/dist/commands/daemon/profile.js +51 -0
- package/dist/commands/goals/briefing/status.js +1 -1
- package/dist/commands/initiatives/worker/deactivate.d.ts +23 -0
- package/dist/commands/initiatives/worker/deactivate.js +78 -0
- package/dist/commands/login.js +8 -2
- package/dist/commands/logout.d.ts +20 -0
- package/dist/commands/logout.js +110 -5
- package/dist/commands/machines/profiles/disconnect.d.ts +23 -0
- package/dist/commands/machines/profiles/disconnect.js +102 -0
- package/dist/commands/machines/profiles/index.d.ts +15 -0
- package/dist/commands/machines/profiles/index.js +33 -0
- package/dist/commands/machines/profiles/label.d.ts +24 -0
- package/dist/commands/machines/profiles/label.js +85 -0
- package/dist/commands/machines/profiles/list.d.ts +16 -0
- package/dist/commands/machines/profiles/list.js +87 -0
- package/dist/commands/memory/maintain.js +16 -2
- package/dist/commands/profiles/list.js +17 -2
- package/dist/commands/spaces/delete.js +6 -1
- package/dist/commands/spaces/workflows/archive.js +6 -1
- package/dist/commands/spaces/workflows/publish.js +3 -1
- package/dist/commands/spaces/workflows/run.d.ts +1 -0
- package/dist/commands/spaces/workflows/run.js +17 -1
- package/dist/commands/spaces/workflows/triggers/create.js +3 -1
- package/dist/commands/tasks/workflow-context.js +3 -1
- package/dist/commands/triggers/authorization.js +1 -1
- package/dist/commands/triggers/capabilities.js +17 -1
- package/dist/commands/triggers/create.d.ts +2 -0
- package/dist/commands/triggers/create.js +23 -7
- package/dist/commands/triggers/fire-detail.js +12 -3
- package/dist/commands/triggers/list.d.ts +1 -0
- package/dist/commands/triggers/list.js +13 -1
- package/dist/commands/triggers/preflight.js +18 -0
- package/dist/commands/triggers/prune.js +9 -5
- package/dist/commands/triggers/update.js +13 -4
- package/dist/generated/agent-guides.json +35 -35
- package/dist/lib/agent-guides.js +1 -1
- package/dist/lib/agent-proactive-baseline.d.ts +6 -0
- package/dist/lib/agent-proactive-baseline.js +32 -3
- package/dist/lib/always-on-command-result.d.ts +18 -0
- package/dist/lib/always-on-command-result.js +52 -0
- package/dist/lib/always-on-runtime.d.ts +31 -0
- package/dist/lib/always-on-runtime.js +39 -0
- package/dist/lib/auth-diagnostics.d.ts +10 -1
- package/dist/lib/auth-diagnostics.js +16 -8
- package/dist/lib/commitments.d.ts +16 -9
- package/dist/lib/commitments.js +65 -4
- package/dist/lib/compasses.js +5 -0
- package/dist/lib/daemon-binding.js +6 -3
- package/dist/lib/daemon-command-hint.d.ts +10 -5
- package/dist/lib/daemon-command-hint.js +11 -6
- package/dist/lib/daemon-setup.js +9 -3
- package/dist/lib/daemonBroker.d.ts +7 -0
- package/dist/lib/daemonBroker.js +5 -0
- package/dist/lib/daemonHandoff.d.ts +2 -0
- package/dist/lib/daemonHandoff.js +16 -3
- package/dist/lib/daemonIslandProfile.d.ts +19 -0
- package/dist/lib/daemonIslandProfile.js +41 -0
- package/dist/lib/drain-stdio.d.ts +22 -0
- package/dist/lib/drain-stdio.js +46 -0
- package/dist/lib/format.d.ts +32 -0
- package/dist/lib/format.js +105 -1
- package/dist/lib/initiatives-worker.d.ts +25 -0
- package/dist/lib/initiatives-worker.js +13 -0
- package/dist/lib/keychain.d.ts +22 -1
- package/dist/lib/keychain.js +40 -1
- package/dist/lib/local-daemon-readiness.js +4 -6
- package/dist/lib/local-skills.js +4 -1
- package/dist/lib/login.d.ts +7 -0
- package/dist/lib/login.js +5 -0
- package/dist/lib/machines.d.ts +68 -0
- package/dist/lib/machines.js +67 -0
- package/dist/lib/proactive-audit.d.ts +52 -0
- package/dist/lib/proactive-audit.js +67 -0
- package/dist/lib/proactiveApi.d.ts +23 -0
- package/dist/lib/refresh.d.ts +20 -6
- package/dist/lib/refresh.js +27 -9
- package/dist/lib/roles.d.ts +1 -1
- package/dist/lib/runtime-start-verification.js +3 -6
- package/dist/lib/schedule.d.ts +189 -9
- package/dist/lib/schedule.js +283 -22
- package/dist/lib/triggers.d.ts +134 -3
- package/dist/lib/triggers.js +370 -17
- package/dist/lib/workflow-node-control.js +8 -0
- package/dist/lib/workflow-run-view.js +9 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/configRoot.d.ts +12 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/configRoot.js +10 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.d.ts +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +22 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/executorStopReceiptV2.d.ts +133 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/executorStopReceiptV2.js +180 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +5 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +50 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profilePorts.d.ts +137 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profilePorts.js +328 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileSelection.d.ts +63 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileSelection.js +174 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.d.ts +22 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +15 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/configRoot.d.ts +12 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/configRoot.js +14 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.d.ts +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +27 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/executorStopReceiptV2.d.ts +133 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/executorStopReceiptV2.js +183 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +5 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +11 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profilePorts.d.ts +137 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profilePorts.js +333 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileSelection.d.ts +63 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileSelection.js +212 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.d.ts +22 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +22 -4
- package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +7446 -7378
- package/oclif.manifest.json +844 -47
- package/package.json +1 -1
package/dist/commands/logout.js
CHANGED
|
@@ -34,6 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.shouldSkipLocalLogout = shouldSkipLocalLogout;
|
|
37
|
+
exports.unrevokedSessionReason = unrevokedSessionReason;
|
|
38
|
+
exports.unrevokedSessionRemedy = unrevokedSessionRemedy;
|
|
37
39
|
const core_1 = require("@oclif/core");
|
|
38
40
|
const base_command_1 = require("../base-command");
|
|
39
41
|
const config_1 = require("../lib/config");
|
|
@@ -42,6 +44,7 @@ const auth_storage_1 = require("../lib/auth-storage");
|
|
|
42
44
|
const daemonBroker_1 = require("../lib/daemonBroker");
|
|
43
45
|
const dedicated_service_1 = require("../lib/dedicated-service");
|
|
44
46
|
const refresh_1 = require("../lib/refresh");
|
|
47
|
+
const cli_id_1 = require("../lib/cli-id");
|
|
45
48
|
const api_fetch_1 = require("../lib/api-fetch");
|
|
46
49
|
const cred_envelope_1 = require("../lib/cred-envelope");
|
|
47
50
|
const device_identity_1 = require("../lib/device-identity");
|
|
@@ -52,6 +55,54 @@ function shouldSkipLocalLogout(input) {
|
|
|
52
55
|
!input.hasUnreadableEncryptedToken &&
|
|
53
56
|
!input.allDevices);
|
|
54
57
|
}
|
|
58
|
+
function hostOf(serverUrl) {
|
|
59
|
+
try {
|
|
60
|
+
return new URL(serverUrl).host || serverUrl;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return serverUrl;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Why the sign-in this logout removed is still a live session on the server,
|
|
68
|
+
* or null when the server took the revoke, or there was no session to revoke.
|
|
69
|
+
*
|
|
70
|
+
* Logout clears the local credential whatever the server says, so a person can
|
|
71
|
+
* always sign out of a computer. It used to say "Signed out." either way, and a
|
|
72
|
+
* session the server never heard about stayed usable with nothing to show for
|
|
73
|
+
* it (OSK-22307: a profile whose files `skrrd profile remove` had moved could
|
|
74
|
+
* not decrypt its CLI credential, so nothing was sent).
|
|
75
|
+
*/
|
|
76
|
+
function unrevokedSessionReason(input) {
|
|
77
|
+
const { revoke } = input;
|
|
78
|
+
const host = hostOf(input.serverUrl);
|
|
79
|
+
switch (revoke.outcome) {
|
|
80
|
+
case 'accepted':
|
|
81
|
+
return null;
|
|
82
|
+
case 'refused':
|
|
83
|
+
return `${host} answered HTTP ${revoke.status}`;
|
|
84
|
+
case 'unreachable':
|
|
85
|
+
return `${host} could not be reached (${revoke.detail})`;
|
|
86
|
+
case 'not_sent':
|
|
87
|
+
if (input.hasUnreadableEncryptedToken) {
|
|
88
|
+
return 'the stored sign-in could not be decrypted on this computer, so there was nothing to present to the server';
|
|
89
|
+
}
|
|
90
|
+
if (revoke.reason === 'read_failed') {
|
|
91
|
+
return `the stored sign-in could not be read (${revoke.detail ?? 'unknown error'})`;
|
|
92
|
+
}
|
|
93
|
+
if (revoke.reason === 'no_credential' && input.hasAnyStoredToken) {
|
|
94
|
+
return `the stored sign-in is not bound to ${host}, so it was not sent there`;
|
|
95
|
+
}
|
|
96
|
+
// Nothing stored, or a token with no session behind it to end here.
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** How to end a session this computer could not revoke, from a profile still signed in. */
|
|
101
|
+
function unrevokedSessionRemedy(cliId) {
|
|
102
|
+
const which = cliId ? `the row whose DAEMON is ${cliId}` : "this computer's CLI session";
|
|
103
|
+
return ('It stays usable until it expires. To end it now, run `skrr token list --kind cli` ' +
|
|
104
|
+
`from a profile that is still signed in, find ${which}, and run \`skrr token revoke <id>\`.`);
|
|
105
|
+
}
|
|
55
106
|
/**
|
|
56
107
|
* `skrr logout` / `skrr logout --all-devices`
|
|
57
108
|
*
|
|
@@ -125,6 +176,12 @@ class Logout extends base_command_1.BaseCommand {
|
|
|
125
176
|
description: 'Skip the --all-devices confirmation prompt (CI / scripting).',
|
|
126
177
|
default: false,
|
|
127
178
|
}),
|
|
179
|
+
json: core_1.Flags.boolean({
|
|
180
|
+
description: 'Print the outcome as JSON: whether a local sign-in was removed and whether its ' +
|
|
181
|
+
'server session was revoked. `ok` is false when a session was left live.',
|
|
182
|
+
default: false,
|
|
183
|
+
exclusive: ['all-devices'],
|
|
184
|
+
}),
|
|
128
185
|
};
|
|
129
186
|
async run() {
|
|
130
187
|
const { flags } = await this.parse(Logout);
|
|
@@ -147,6 +204,14 @@ class Logout extends base_command_1.BaseCommand {
|
|
|
147
204
|
// `access_token`) there IS no local credential to clear — the CLI holds
|
|
148
205
|
// a per-process token redeemed over loopback and nothing is persisted.
|
|
149
206
|
// Say that honestly rather than reporting a logout that did not happen.
|
|
207
|
+
if (flags.json) {
|
|
208
|
+
this.printJsonResult({
|
|
209
|
+
signedOut: false,
|
|
210
|
+
profile: keychain.getActiveProfile(),
|
|
211
|
+
serverSession: 'none',
|
|
212
|
+
});
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
150
215
|
if (platformManagedHandoff()) {
|
|
151
216
|
this.log("This machine is signed in through the platform's managed hand-off; " +
|
|
152
217
|
'there is no local credential to clear.');
|
|
@@ -186,13 +251,29 @@ class Logout extends base_command_1.BaseCommand {
|
|
|
186
251
|
// every daemon-scope refresh session, but the CLI's OWN refresh
|
|
187
252
|
// session is a `scope='cli'` row without a Daemon FK and was NOT
|
|
188
253
|
// touched by the iteration. This call gets it.
|
|
254
|
+
//
|
|
255
|
+
// Its outcome is reported, never a reason to stop: logout must succeed
|
|
256
|
+
// locally even when the API host is unreachable.
|
|
257
|
+
let revoke;
|
|
189
258
|
try {
|
|
190
|
-
await (0, refresh_1.revokeCurrentRefreshToken)();
|
|
259
|
+
revoke = await (0, refresh_1.revokeCurrentRefreshToken)();
|
|
191
260
|
}
|
|
192
|
-
catch {
|
|
193
|
-
|
|
194
|
-
|
|
261
|
+
catch (err) {
|
|
262
|
+
revoke = {
|
|
263
|
+
outcome: 'not_sent',
|
|
264
|
+
reason: 'read_failed',
|
|
265
|
+
detail: err instanceof Error ? err.message : String(err),
|
|
266
|
+
};
|
|
195
267
|
}
|
|
268
|
+
// Read before the config is rewritten below, which keeps it anyway.
|
|
269
|
+
const configBefore = (0, config_1.loadConfig)();
|
|
270
|
+
const unrevoked = unrevokedSessionReason({
|
|
271
|
+
revoke,
|
|
272
|
+
hasUnreadableEncryptedToken,
|
|
273
|
+
hasAnyStoredToken,
|
|
274
|
+
serverUrl: configBefore.baseURL,
|
|
275
|
+
});
|
|
276
|
+
const cliId = (0, cli_id_1.resolveCliId)(configBefore);
|
|
196
277
|
(0, auth_storage_1.clearAllBackends)();
|
|
197
278
|
// Sweep the credentials this product wrote under its PREVIOUS brand.
|
|
198
279
|
//
|
|
@@ -265,12 +346,36 @@ class Logout extends base_command_1.BaseCommand {
|
|
|
265
346
|
// below); `skrr login` clears the flag.
|
|
266
347
|
adoptDaemonSession: false,
|
|
267
348
|
});
|
|
349
|
+
if (flags.json) {
|
|
350
|
+
this.printJsonResult({
|
|
351
|
+
signedOut: true,
|
|
352
|
+
profile: keychain.getActiveProfile(),
|
|
353
|
+
server: configBefore.baseURL,
|
|
354
|
+
cliId: cliId ?? null,
|
|
355
|
+
serverSession: unrevoked
|
|
356
|
+
? 'not_revoked'
|
|
357
|
+
: revoke.outcome === 'accepted'
|
|
358
|
+
? 'revoked'
|
|
359
|
+
: 'none',
|
|
360
|
+
...(unrevoked ? { reason: unrevoked } : {}),
|
|
361
|
+
...(sweptLegacy.length > 0 ? { removedLegacyCredentials: sweptLegacy } : {}),
|
|
362
|
+
}, { ok: !unrevoked });
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
268
365
|
const finalMessage = flags['all-devices']
|
|
269
366
|
? allDevicesError
|
|
270
367
|
? 'Signed out locally. Remote daemons NOT revoked (see warning above).'
|
|
271
368
|
: 'Signed out from all devices.'
|
|
272
|
-
:
|
|
369
|
+
: unrevoked
|
|
370
|
+
? `Signed out on this computer, but its session was NOT revoked: ${unrevoked}.`
|
|
371
|
+
: 'Signed out.';
|
|
273
372
|
this.log(finalMessage);
|
|
373
|
+
if (unrevoked) {
|
|
374
|
+
if (flags['all-devices']) {
|
|
375
|
+
this.log(`This computer's own CLI session was NOT revoked: ${unrevoked}.`);
|
|
376
|
+
}
|
|
377
|
+
this.log(unrevokedSessionRemedy(cliId));
|
|
378
|
+
}
|
|
274
379
|
// On a brokered Dedicated guest the sign-in just removed was the person's
|
|
275
380
|
// OWN (an explicit `skrr login`); the machine's platform-managed access is
|
|
276
381
|
// untouched and skrr keeps working through it. Say both, so "Signed out."
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* `skrr machines profiles disconnect <machine> <profile>` (OSK-22306).
|
|
4
|
+
*
|
|
5
|
+
* Revokes ONE daemon profile's access and retires its harness rows; the
|
|
6
|
+
* machine's other profiles stay connected. `skrr machines disconnect` is the
|
|
7
|
+
* whole machine. Like it, this is not a delete: nothing on the computer is
|
|
8
|
+
* stopped or removed (`skrr daemon profile remove` does that, on the computer).
|
|
9
|
+
*/
|
|
10
|
+
export default class MachinesProfilesDisconnect extends BaseCommand {
|
|
11
|
+
static description: string;
|
|
12
|
+
static examples: string[];
|
|
13
|
+
static args: {
|
|
14
|
+
machine: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
15
|
+
profile: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
16
|
+
};
|
|
17
|
+
static flags: {
|
|
18
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
'clear-label': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
21
|
+
};
|
|
22
|
+
run(): Promise<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../../base-command");
|
|
5
|
+
const machines_1 = require("../../../lib/machines");
|
|
6
|
+
/**
|
|
7
|
+
* `skrr machines profiles disconnect <machine> <profile>` (OSK-22306).
|
|
8
|
+
*
|
|
9
|
+
* Revokes ONE daemon profile's access and retires its harness rows; the
|
|
10
|
+
* machine's other profiles stay connected. `skrr machines disconnect` is the
|
|
11
|
+
* whole machine. Like it, this is not a delete: nothing on the computer is
|
|
12
|
+
* stopped or removed (`skrr daemon profile remove` does that, on the computer).
|
|
13
|
+
*/
|
|
14
|
+
class MachinesProfilesDisconnect extends base_command_1.BaseCommand {
|
|
15
|
+
static description = "Disconnect one daemon profile of a machine — revokes that profile's access and leaves the others connected";
|
|
16
|
+
static examples = [
|
|
17
|
+
'<%= config.bin %> machines profiles disconnect 03548116 work',
|
|
18
|
+
'<%= config.bin %> machines profiles disconnect 03548116 work --yes',
|
|
19
|
+
'<%= config.bin %> machines profiles disconnect 03548116 work --yes --clear-label',
|
|
20
|
+
];
|
|
21
|
+
static args = {
|
|
22
|
+
machine: core_1.Args.string({
|
|
23
|
+
ignoreStdin: true,
|
|
24
|
+
description: 'Machine id, uuid, daemon id, name, or a unique prefix',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
profile: core_1.Args.string({
|
|
28
|
+
ignoreStdin: true,
|
|
29
|
+
description: 'The profile name, exactly as `skrr machines profiles list` prints it',
|
|
30
|
+
required: true,
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
static flags = {
|
|
34
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
35
|
+
yes: core_1.Flags.boolean({ description: 'Skip the confirmation prompt', char: 'y' }),
|
|
36
|
+
'clear-label': core_1.Flags.boolean({
|
|
37
|
+
description: "Also delete the profile's display label (kept by default, so a reconnect shows it again)",
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
async run() {
|
|
41
|
+
this.requireAuth();
|
|
42
|
+
const { args, flags } = await this.parse(MachinesProfilesDisconnect);
|
|
43
|
+
let machine;
|
|
44
|
+
try {
|
|
45
|
+
machine = (0, machines_1.resolveMachineRef)(await (0, machines_1.listMachines)(), args.machine);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
this.handleApiError(err);
|
|
49
|
+
}
|
|
50
|
+
if (!machine) {
|
|
51
|
+
this.error('Machine not found.', { exit: 1 });
|
|
52
|
+
}
|
|
53
|
+
const machineName = machine.preferences?.name || machine.name;
|
|
54
|
+
if (!flags.yes) {
|
|
55
|
+
const profiles = (0, machines_1.summarizeMachineProfiles)(machine.harnesses ?? []);
|
|
56
|
+
const target = profiles.find((profile) => profile.name === args.profile);
|
|
57
|
+
const others = profiles.filter((profile) => profile.name !== args.profile);
|
|
58
|
+
this.log(`This revokes daemon profile "${args.profile}"'s access on "${machineName}" (${machine.id}).`);
|
|
59
|
+
if (target) {
|
|
60
|
+
const count = target.harnessCount;
|
|
61
|
+
this.log(`${count} harness${count === 1 ? '' : 'es'} of that profile will stop being reachable.`);
|
|
62
|
+
}
|
|
63
|
+
if (others.length > 0) {
|
|
64
|
+
this.log(`Still connected afterwards: ${others.map((profile) => profile.name).join(', ')}.`);
|
|
65
|
+
}
|
|
66
|
+
this.log('Nothing on the computer is stopped or removed. The profile connects again only after it signs in again.');
|
|
67
|
+
this.error('Re-run with --yes to confirm.', { exit: 1 });
|
|
68
|
+
}
|
|
69
|
+
let result;
|
|
70
|
+
try {
|
|
71
|
+
result = await (0, machines_1.disconnectMachineProfile)(machine.id, args.profile, {
|
|
72
|
+
clearLabel: flags['clear-label'],
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
this.handleApiError(err);
|
|
77
|
+
}
|
|
78
|
+
if (flags.json) {
|
|
79
|
+
this.printJsonResult(result);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.log(`Disconnected profile "${args.profile}" on ${machineName} (${machine.id}).`);
|
|
83
|
+
if (!result)
|
|
84
|
+
return;
|
|
85
|
+
const retired = result.retiredHarnesses;
|
|
86
|
+
this.log(` ${retired} harness${retired === 1 ? '' : 'es'} retired; ` +
|
|
87
|
+
`${result.revokedSessions} sign-in session${result.revokedSessions === 1 ? '' : 's'} revoked` +
|
|
88
|
+
(result.releasedHolds > 0 ? `; ${result.releasedHolds} maintenance hold(s) released` : '') +
|
|
89
|
+
'.');
|
|
90
|
+
if (result.sharedIdentity) {
|
|
91
|
+
// A profile created before each profile got its own machine id shares the
|
|
92
|
+
// computer's server identity. Revoking that identity would disconnect every
|
|
93
|
+
// profile, so only this one's sessions went.
|
|
94
|
+
const others = result.otherProfiles?.length ? ` (${result.otherProfiles.join(', ')})` : '';
|
|
95
|
+
this.log(` This profile shares the computer's identity with other profiles${others}, ` +
|
|
96
|
+
'so only its own sign-in was revoked; they stay connected.');
|
|
97
|
+
}
|
|
98
|
+
this.log(` To connect it again, sign it in on the computer: ${this.config.bin} daemon login --profile ${args.profile}`);
|
|
99
|
+
this.log(` To remove it from the computer: ${this.config.bin} daemon profile remove ${args.profile} (run there)`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.default = MachinesProfilesDisconnect;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* `skrr machines profiles` — the daemon profiles registered on one machine
|
|
4
|
+
* (OSK-22306, OSK-22308). One computer can run several profiles, each a
|
|
5
|
+
* separate daemon with its own sign-in; this topic shows them, labels them,
|
|
6
|
+
* and disconnects one without touching the others.
|
|
7
|
+
*
|
|
8
|
+
* Creating and removing a profile on the computer itself is the runtime's
|
|
9
|
+
* job: `skrr daemon profile` forwards to `skrrd profile`.
|
|
10
|
+
*/
|
|
11
|
+
export default class MachinesProfiles extends Command {
|
|
12
|
+
static description: string;
|
|
13
|
+
static examples: string[];
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
/**
|
|
5
|
+
* `skrr machines profiles` — the daemon profiles registered on one machine
|
|
6
|
+
* (OSK-22306, OSK-22308). One computer can run several profiles, each a
|
|
7
|
+
* separate daemon with its own sign-in; this topic shows them, labels them,
|
|
8
|
+
* and disconnects one without touching the others.
|
|
9
|
+
*
|
|
10
|
+
* Creating and removing a profile on the computer itself is the runtime's
|
|
11
|
+
* job: `skrr daemon profile` forwards to `skrrd profile`.
|
|
12
|
+
*/
|
|
13
|
+
class MachinesProfiles extends core_1.Command {
|
|
14
|
+
static description = 'Daemon profiles on a machine — list them, label them, or disconnect one without the others';
|
|
15
|
+
static examples = [
|
|
16
|
+
'<%= config.bin %> machines profiles list 03548116',
|
|
17
|
+
'<%= config.bin %> machines profiles label 03548116 work --label "Work laptop"',
|
|
18
|
+
'<%= config.bin %> machines profiles disconnect 03548116 work --yes',
|
|
19
|
+
];
|
|
20
|
+
async run() {
|
|
21
|
+
const rows = [
|
|
22
|
+
['list', 'the profiles that have registered on a machine'],
|
|
23
|
+
['label', 'give a profile a display name and note (its name cannot change)'],
|
|
24
|
+
['disconnect', "revoke one profile's access, leaving the machine's other profiles connected"],
|
|
25
|
+
];
|
|
26
|
+
this.log('Daemon profiles (skrr machines profiles <command>):');
|
|
27
|
+
for (const [name, what] of rows)
|
|
28
|
+
this.log(` ${name.padEnd(11)} ${what}`);
|
|
29
|
+
this.log('');
|
|
30
|
+
this.log('To create or remove a profile on the computer itself: skrr daemon profile --help');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.default = MachinesProfiles;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* `skrr machines profiles label <machine> <profile>` (OSK-22308).
|
|
4
|
+
*
|
|
5
|
+
* A profile's NAME cannot change: it is a directory, a Keychain suffix, a
|
|
6
|
+
* service label and part of its runtime key. What a rename is for — a name a
|
|
7
|
+
* person recognises — is this display label, which nothing that decides
|
|
8
|
+
* identity, permission or routing reads.
|
|
9
|
+
*/
|
|
10
|
+
export default class MachinesProfilesLabel extends BaseCommand {
|
|
11
|
+
static description: string;
|
|
12
|
+
static examples: string[];
|
|
13
|
+
static args: {
|
|
14
|
+
machine: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
15
|
+
profile: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
16
|
+
};
|
|
17
|
+
static flags: {
|
|
18
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
label: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
clear: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
22
|
+
};
|
|
23
|
+
run(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../../base-command");
|
|
5
|
+
const machines_1 = require("../../../lib/machines");
|
|
6
|
+
/**
|
|
7
|
+
* `skrr machines profiles label <machine> <profile>` (OSK-22308).
|
|
8
|
+
*
|
|
9
|
+
* A profile's NAME cannot change: it is a directory, a Keychain suffix, a
|
|
10
|
+
* service label and part of its runtime key. What a rename is for — a name a
|
|
11
|
+
* person recognises — is this display label, which nothing that decides
|
|
12
|
+
* identity, permission or routing reads.
|
|
13
|
+
*/
|
|
14
|
+
class MachinesProfilesLabel extends base_command_1.BaseCommand {
|
|
15
|
+
static description = "Set or clear a daemon profile's display label and description (the profile's name itself cannot change)";
|
|
16
|
+
static examples = [
|
|
17
|
+
'<%= config.bin %> machines profiles label 03548116 work --label "Work laptop"',
|
|
18
|
+
'<%= config.bin %> machines profiles label 03548116 work --description "Client repos only"',
|
|
19
|
+
'<%= config.bin %> machines profiles label 03548116 work --clear',
|
|
20
|
+
];
|
|
21
|
+
static args = {
|
|
22
|
+
machine: core_1.Args.string({
|
|
23
|
+
ignoreStdin: true,
|
|
24
|
+
description: 'Machine id, uuid, daemon id, name, or a unique prefix',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
profile: core_1.Args.string({
|
|
28
|
+
ignoreStdin: true,
|
|
29
|
+
description: 'The profile name, exactly as `skrr machines profiles list` prints it',
|
|
30
|
+
required: true,
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
static flags = {
|
|
34
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
35
|
+
label: core_1.Flags.string({ description: 'Display label, up to 64 characters ("" clears it)' }),
|
|
36
|
+
description: core_1.Flags.string({ description: 'A note, up to 280 characters ("" clears it)' }),
|
|
37
|
+
clear: core_1.Flags.boolean({
|
|
38
|
+
description: 'Clear both the label and the description',
|
|
39
|
+
exclusive: ['label', 'description'],
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
async run() {
|
|
43
|
+
this.requireAuth();
|
|
44
|
+
const { args, flags } = await this.parse(MachinesProfilesLabel);
|
|
45
|
+
const patch = flags.clear
|
|
46
|
+
? { label: '', description: '' }
|
|
47
|
+
: {
|
|
48
|
+
...(flags.label !== undefined ? { label: flags.label } : {}),
|
|
49
|
+
...(flags.description !== undefined ? { description: flags.description } : {}),
|
|
50
|
+
};
|
|
51
|
+
if (Object.keys(patch).length === 0) {
|
|
52
|
+
this.error('Pass --label, --description, or --clear.', { exit: 2 });
|
|
53
|
+
}
|
|
54
|
+
let machine;
|
|
55
|
+
try {
|
|
56
|
+
machine = (0, machines_1.resolveMachineRef)(await (0, machines_1.listMachines)(), args.machine);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
this.handleApiError(err);
|
|
60
|
+
}
|
|
61
|
+
if (!machine) {
|
|
62
|
+
this.error('Machine not found.', { exit: 1 });
|
|
63
|
+
}
|
|
64
|
+
let result;
|
|
65
|
+
try {
|
|
66
|
+
result = await (0, machines_1.setMachineProfileLabel)(machine.id, args.profile, patch);
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
this.handleApiError(err);
|
|
70
|
+
}
|
|
71
|
+
if (flags.json) {
|
|
72
|
+
this.printJsonResult(result);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const stored = result?.label ?? null;
|
|
76
|
+
if (!stored) {
|
|
77
|
+
this.log(`Profile "${args.profile}" has no label now; surfaces show its name.`);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
this.log(`Profile "${args.profile}" is labelled ${stored.label ? `"${stored.label}"` : '(no label)'}` +
|
|
81
|
+
(stored.description ? ` — ${stored.description}` : '') +
|
|
82
|
+
'.');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.default = MachinesProfilesLabel;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* `skrr machines profiles list <machine>` — the daemon profiles that have
|
|
4
|
+
* registered on one machine, read from its harness rows (OSK-22306).
|
|
5
|
+
*/
|
|
6
|
+
export default class MachinesProfilesList extends BaseCommand {
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static args: {
|
|
10
|
+
machine: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
11
|
+
};
|
|
12
|
+
static flags: {
|
|
13
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../../../base-command");
|
|
6
|
+
const harness_labels_1 = require("../../../lib/harness-labels");
|
|
7
|
+
const list_output_1 = require("../../../lib/list-output");
|
|
8
|
+
const machines_1 = require("../../../lib/machines");
|
|
9
|
+
const format_1 = require("../../../lib/format");
|
|
10
|
+
/**
|
|
11
|
+
* `skrr machines profiles list <machine>` — the daemon profiles that have
|
|
12
|
+
* registered on one machine, read from its harness rows (OSK-22306).
|
|
13
|
+
*/
|
|
14
|
+
class MachinesProfilesList extends base_command_1.BaseCommand {
|
|
15
|
+
static description = 'List the daemon profiles that have registered on a machine';
|
|
16
|
+
static examples = [
|
|
17
|
+
'<%= config.bin %> machines profiles list 03548116',
|
|
18
|
+
'<%= config.bin %> machines profiles list "Frank MacBook" --json',
|
|
19
|
+
];
|
|
20
|
+
static args = {
|
|
21
|
+
machine: core_1.Args.string({
|
|
22
|
+
ignoreStdin: true,
|
|
23
|
+
description: 'Machine id, uuid, daemon id, name, or a unique prefix',
|
|
24
|
+
required: true,
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
static flags = {
|
|
28
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
29
|
+
};
|
|
30
|
+
async run() {
|
|
31
|
+
this.requireAuth();
|
|
32
|
+
const { args, flags } = await this.parse(MachinesProfilesList);
|
|
33
|
+
let machine;
|
|
34
|
+
try {
|
|
35
|
+
machine = (0, machines_1.resolveMachineRef)(await (0, machines_1.listMachines)(), args.machine);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
this.handleApiError(err);
|
|
39
|
+
}
|
|
40
|
+
if (!machine) {
|
|
41
|
+
this.error('Machine not found.', { exit: 1 });
|
|
42
|
+
}
|
|
43
|
+
const profiles = (0, machines_1.summarizeMachineProfiles)(machine.harnesses ?? []);
|
|
44
|
+
if (flags.json) {
|
|
45
|
+
this.printJsonResult((0, list_output_1.listResult)(profiles));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const machineName = machine.preferences?.name || machine.name;
|
|
49
|
+
if (profiles.length === 0) {
|
|
50
|
+
this.log(`No daemon profile has registered on "${machineName}" (${machine.id}).`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this.log(`Daemon profiles on "${machineName}" (${machine.id})`);
|
|
54
|
+
(0, format_1.renderTable)(profiles.map((profile) => ({
|
|
55
|
+
name: profile.name,
|
|
56
|
+
label: (0, format_1.formatCell)(labelCell(profile)),
|
|
57
|
+
status: profile.status,
|
|
58
|
+
harnesses: describeHarnesses(profile),
|
|
59
|
+
seen: (0, format_1.localStamp)(profile.lastSeenAt),
|
|
60
|
+
})), [
|
|
61
|
+
{ key: 'name', header: 'PROFILE' },
|
|
62
|
+
{ key: 'label', header: 'LABEL' },
|
|
63
|
+
{ key: 'status', header: 'STATUS' },
|
|
64
|
+
{ key: 'harnesses', header: 'HARNESSES' },
|
|
65
|
+
{ key: 'seen', header: `LAST SEEN (${(0, format_1.localZone)()})` },
|
|
66
|
+
], (line) => this.log(line));
|
|
67
|
+
const notes = profiles.filter((profile) => profile.label?.description);
|
|
68
|
+
for (const profile of notes) {
|
|
69
|
+
this.log(` ${profile.name}: ${profile.label?.description}`);
|
|
70
|
+
}
|
|
71
|
+
this.log('');
|
|
72
|
+
this.log(`Label one: ${this.config.bin} machines profiles label ${machine.id} <profile> --label <text>`);
|
|
73
|
+
this.log(`Disconnect one: ${this.config.bin} machines profiles disconnect ${machine.id} <profile>`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.default = MachinesProfilesList;
|
|
77
|
+
function labelCell(profile) {
|
|
78
|
+
if (profile.label?.label)
|
|
79
|
+
return profile.label.label;
|
|
80
|
+
// The desktop app's background daemon has a generated name; say what it is.
|
|
81
|
+
return (0, data_provider_1.isDesktopBackgroundProfile)(profile.name) ? '(desktop app)' : '-';
|
|
82
|
+
}
|
|
83
|
+
function describeHarnesses(profile) {
|
|
84
|
+
if (profile.harnessCount === 0)
|
|
85
|
+
return '0';
|
|
86
|
+
return `${profile.harnessCount} (${profile.providers.map(harness_labels_1.harnessProviderLabel).join(', ')})`;
|
|
87
|
+
}
|
|
@@ -39,9 +39,12 @@ class MemoryMaintain extends base_command_1.BaseCommand {
|
|
|
39
39
|
}
|
|
40
40
|
let result;
|
|
41
41
|
// Keep stdout machine-readable for --json; progress goes only to stderr.
|
|
42
|
+
// A plain remember takes about 4 to 5 seconds, so the notice waits past that: shown on
|
|
43
|
+
// every ordinary save it carried no information (OSK-22394). Only a save that is
|
|
44
|
+
// actually slow gets it.
|
|
42
45
|
const waiting = args.operation === 'remember' ? setTimeout(() => {
|
|
43
46
|
process.stderr.write('Still waiting for the memory save; the result is not confirmed yet.\n');
|
|
44
|
-
},
|
|
47
|
+
}, 10_000) : null;
|
|
45
48
|
waiting?.unref();
|
|
46
49
|
try {
|
|
47
50
|
if (args.operation === 'remember')
|
|
@@ -55,7 +58,18 @@ class MemoryMaintain extends base_command_1.BaseCommand {
|
|
|
55
58
|
const transportLost = ['ECONNABORTED', 'ETIMEDOUT', 'ECONNRESET', 'EPIPE', 'ERR_NETWORK', 'ECONNREFUSED', 'EAI_AGAIN'].includes(e?.code || '') ||
|
|
56
59
|
e?.name === 'TimeoutError' || /fetch failed|socket hang up|network error|timed out|timeout/i.test(e?.message || '');
|
|
57
60
|
if (args.operation === 'remember' && ((status !== undefined && status >= 500) || (!status && transportLost))) {
|
|
58
|
-
|
|
61
|
+
// The save may have landed, and an identical retry is an idempotent replay (the
|
|
62
|
+
// server answers `idempotentReplay`), so the error is retryable and names the
|
|
63
|
+
// exact read that settles it, as `memory topics create` does (OSK-22393).
|
|
64
|
+
const check = `${this.config.bin} memory topics list --agent ${flags.agent} --scope agent:${flags.agent}`;
|
|
65
|
+
this.failWithCliError({
|
|
66
|
+
message: `The memory save was not confirmed. It may have succeeded. Check with \`${check}\`, ` +
|
|
67
|
+
'or run the exact same command again: an identical retry is safe and is answered as an idempotent replay if the first save landed.',
|
|
68
|
+
code: 'MEMORY_OUTCOME_UNKNOWN',
|
|
69
|
+
exit: 1,
|
|
70
|
+
retryable: true,
|
|
71
|
+
details: { outcome: 'unknown', operation: 'remember', agentId: flags.agent, check },
|
|
72
|
+
});
|
|
59
73
|
}
|
|
60
74
|
this.handleApiError(error);
|
|
61
75
|
}
|
|
@@ -9,6 +9,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
9
9
|
const core_1 = require("@oclif/core");
|
|
10
10
|
const base_command_1 = require("../../base-command");
|
|
11
11
|
const config_1 = require("../../lib/config");
|
|
12
|
+
const auth_core_1 = require("@skrr-ai/auth-core");
|
|
12
13
|
const keychain_1 = require("../../lib/keychain");
|
|
13
14
|
/**
|
|
14
15
|
* Which stored sessions exist on this machine.
|
|
@@ -37,7 +38,13 @@ class ProfilesList extends base_command_1.BaseCommand {
|
|
|
37
38
|
async run() {
|
|
38
39
|
const { flags } = await this.parse(ProfilesList);
|
|
39
40
|
const root = (0, config_1.configRoot)();
|
|
40
|
-
|
|
41
|
+
// How the active profile was chosen, and what the sticky selector names.
|
|
42
|
+
// Both binaries resolve by the same rule now (OSK-22299), so the pin
|
|
43
|
+
// `skrrd profile use` writes is the CLI's pin too; say so here, because a
|
|
44
|
+
// pinned profile is otherwise invisible until a command acts on it.
|
|
45
|
+
const selection = (0, keychain_1.getActiveProfileSelection)();
|
|
46
|
+
const active = selection.profile || keychain_1.DEFAULT_PROFILE;
|
|
47
|
+
const pinned = (0, auth_core_1.readProfileLock)();
|
|
41
48
|
const rows = [];
|
|
42
49
|
const seen = new Set();
|
|
43
50
|
const describe = (name, configFile) => {
|
|
@@ -79,7 +86,7 @@ class ProfilesList extends base_command_1.BaseCommand {
|
|
|
79
86
|
// No `profiles/` directory means no named profiles — not an error.
|
|
80
87
|
}
|
|
81
88
|
if (flags.json) {
|
|
82
|
-
this.printJsonResult((0, list_output_1.listResult)({ root, active, profiles: rows }, 'profiles'));
|
|
89
|
+
this.printJsonResult((0, list_output_1.listResult)({ root, active, activeSource: selection.source, pinned, profiles: rows }, 'profiles'));
|
|
83
90
|
return;
|
|
84
91
|
}
|
|
85
92
|
// Width from the DATA, so a long profile name cannot run into the next
|
|
@@ -90,8 +97,16 @@ class ProfilesList extends base_command_1.BaseCommand {
|
|
|
90
97
|
this.log(row.name.padEnd(width) + (row.active ? 'yes' : '-').padEnd(9) + (row.server || '-'));
|
|
91
98
|
}
|
|
92
99
|
this.log('');
|
|
100
|
+
this.log(`Active: ${(0, auth_core_1.describeProfileSelection)(selection)}`);
|
|
101
|
+
if (pinned && pinned !== active) {
|
|
102
|
+
this.log(`Pinned: ${pinned} (overridden for this command)`);
|
|
103
|
+
}
|
|
93
104
|
this.log(`Add one: ${this.config.bin} login --profile <name>`);
|
|
94
105
|
this.log(`Use one: ${this.config.bin} <command> --profile <name> (or OVERSKY_PROFILE)`);
|
|
106
|
+
// Through `skrr daemon profile`, which forwards to the runtime: `skrrd` is not on
|
|
107
|
+
// PATH in every install (the desktop app carries its own).
|
|
108
|
+
this.log(`Pin one: ${this.config.bin} daemon profile use <name> (clear with: ${this.config.bin} daemon profile clear)`);
|
|
109
|
+
this.log(`Remove: ${this.config.bin} daemon profile remove <name> (a dry run; add --apply to remove)`);
|
|
95
110
|
}
|
|
96
111
|
}
|
|
97
112
|
exports.default = ProfilesList;
|