@skrr-ai/cli 0.1.142 → 0.1.143

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.
Files changed (83) hide show
  1. package/dist/base-command.d.ts +4 -2
  2. package/dist/base-command.js +46 -13
  3. package/dist/commands/agents/always-on/disable.js +9 -1
  4. package/dist/commands/agents/always-on/enable.js +9 -1
  5. package/dist/commands/agents/always-on/status.js +14 -1
  6. package/dist/commands/agents/create.js +10 -1
  7. package/dist/commands/agents/delete.d.ts +6 -0
  8. package/dist/commands/agents/delete.js +24 -0
  9. package/dist/commands/agents/intuitions/list.js +1 -1
  10. package/dist/commands/agents/spawn.d.ts +9 -0
  11. package/dist/commands/agents/spawn.js +121 -5
  12. package/dist/commands/agents/todos/cancel.js +3 -0
  13. package/dist/commands/agents/todos/edit.js +1 -1
  14. package/dist/commands/agents/triggers/policy.js +7 -0
  15. package/dist/commands/commitments/preflight.js +17 -2
  16. package/dist/commands/daemon/index.js +1 -0
  17. package/dist/commands/daemon/logs.d.ts +8 -1
  18. package/dist/commands/daemon/logs.js +32 -22
  19. package/dist/commands/daemon/profile.d.ts +15 -0
  20. package/dist/commands/daemon/profile.js +51 -0
  21. package/dist/commands/goals/briefing/status.js +1 -1
  22. package/dist/commands/machines/profiles/disconnect.d.ts +23 -0
  23. package/dist/commands/machines/profiles/disconnect.js +102 -0
  24. package/dist/commands/machines/profiles/index.d.ts +15 -0
  25. package/dist/commands/machines/profiles/index.js +33 -0
  26. package/dist/commands/machines/profiles/label.d.ts +24 -0
  27. package/dist/commands/machines/profiles/label.js +85 -0
  28. package/dist/commands/machines/profiles/list.d.ts +16 -0
  29. package/dist/commands/machines/profiles/list.js +87 -0
  30. package/dist/commands/profiles/list.js +17 -2
  31. package/dist/commands/triggers/authorization.js +1 -1
  32. package/dist/lib/agent-guides.js +1 -1
  33. package/dist/lib/agent-proactive-baseline.d.ts +6 -0
  34. package/dist/lib/agent-proactive-baseline.js +25 -2
  35. package/dist/lib/always-on-command-result.d.ts +18 -0
  36. package/dist/lib/always-on-command-result.js +52 -0
  37. package/dist/lib/always-on-runtime.d.ts +31 -0
  38. package/dist/lib/always-on-runtime.js +39 -0
  39. package/dist/lib/auth-diagnostics.d.ts +10 -1
  40. package/dist/lib/auth-diagnostics.js +16 -8
  41. package/dist/lib/compasses.js +5 -0
  42. package/dist/lib/daemon-binding.js +6 -3
  43. package/dist/lib/daemon-command-hint.d.ts +10 -5
  44. package/dist/lib/daemon-command-hint.js +11 -6
  45. package/dist/lib/daemonHandoff.js +6 -2
  46. package/dist/lib/drain-stdio.d.ts +22 -0
  47. package/dist/lib/drain-stdio.js +46 -0
  48. package/dist/lib/keychain.d.ts +22 -1
  49. package/dist/lib/keychain.js +40 -1
  50. package/dist/lib/local-daemon-readiness.js +4 -6
  51. package/dist/lib/local-skills.js +4 -1
  52. package/dist/lib/machines.d.ts +68 -0
  53. package/dist/lib/machines.js +67 -0
  54. package/dist/lib/proactiveApi.d.ts +14 -0
  55. package/dist/lib/runtime-start-verification.js +3 -6
  56. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/configRoot.d.ts +12 -0
  57. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/configRoot.js +10 -2
  58. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.d.ts +8 -0
  59. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +22 -0
  60. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/executorStopReceiptV2.d.ts +133 -0
  61. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/executorStopReceiptV2.js +180 -0
  62. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +4 -2
  63. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +48 -0
  64. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profilePorts.d.ts +137 -0
  65. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profilePorts.js +328 -0
  66. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileSelection.d.ts +63 -0
  67. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileSelection.js +174 -0
  68. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/configRoot.d.ts +12 -0
  69. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/configRoot.js +14 -0
  70. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.d.ts +8 -0
  71. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +27 -0
  72. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/executorStopReceiptV2.d.ts +133 -0
  73. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/executorStopReceiptV2.js +183 -0
  74. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +4 -2
  75. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +10 -2
  76. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profilePorts.d.ts +137 -0
  77. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profilePorts.js +333 -0
  78. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileSelection.d.ts +63 -0
  79. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileSelection.js +212 -0
  80. package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
  81. package/dist/node_modules/@skrr-ai/data-provider/index.js +7295 -7265
  82. package/oclif.manifest.json +330 -1
  83. package/package.json +1 -1
@@ -31,9 +31,9 @@ const node_fs_1 = require("node:fs");
31
31
  const node_os_1 = require("node:os");
32
32
  const node_path_1 = __importDefault(require("node:path"));
33
33
  const node_events_1 = require("node:events");
34
+ const auth_core_1 = require("@skrr-ai/auth-core");
34
35
  const exec_runtime_binary_1 = require("../../lib/exec-runtime-binary");
35
36
  const MAX_FALLBACK_LOG_BYTES = 1024 * 1024;
36
- const PROFILE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
37
37
  /**
38
38
  * Older daemons already kept logs in this profile-scoped location, even
39
39
  * though they did not yet expose `oversky logs`. Keep the compatibility path
@@ -82,31 +82,41 @@ function describeLogAge(mtimeMs, now = Date.now()) {
82
82
  };
83
83
  }
84
84
  function resolveLegacyDaemonLogPath(flags, options = {}) {
85
- const home = options.home ?? (0, node_os_1.homedir)();
86
- return node_path_1.default.join(home, '.skrr', 'profiles', resolveDaemonLogsProfile(flags, options), 'logs', flags.stderr ? 'daemon.err.log' : 'daemon.log');
85
+ return node_path_1.default.join((0, auth_core_1.resolveConfigRoot)(daemonLogsEnv(options)), 'profiles', resolveDaemonLogsProfile(flags, options), 'logs', flags.stderr ? 'daemon.err.log' : 'daemon.log');
87
86
  }
88
- /** The profile `logs` addresses: --profile, then the profile environment variable, then the pin. */
89
- function resolveDaemonLogsProfile(flags, options = {}) {
90
- const home = options.home ?? (0, node_os_1.homedir)();
87
+ /**
88
+ * The environment the log lookup resolves the skrr root from. A test (or a
89
+ * caller) that names `home` means `<home>/.skrr` unless the root has been
90
+ * pointed elsewhere explicitly, which is the daemon's own rule for its log
91
+ * directory (`<root>/profiles/<profile>/logs`). This used to join `~/.skrr` by
92
+ * hand and so read the wrong directory under `SKRR_CONFIG_DIR`.
93
+ */
94
+ function daemonLogsEnv(options) {
91
95
  const env = options.env ?? process.env;
92
- // An explicit --profile outranks the environment, as it does everywhere else.
96
+ if (!options.home || (0, auth_core_1.isConfigRootOverridden)(env))
97
+ return env;
98
+ return (0, auth_core_1.withConfigRoot)(env, node_path_1.default.join(options.home, '.skrr'));
99
+ }
100
+ /**
101
+ * The profile `logs` addresses, by the rule `skrr` and `skrrd` share
102
+ * (`resolveProfileSelection`: --profile, then OVERSKY_PROFILE, then the pin).
103
+ *
104
+ * One deliberate difference: a value outside the profile grammar is skipped
105
+ * rather than refused, because this only chooses a file to read and the forwarded
106
+ * `skrrd logs` refuses the same value itself. It is never joined into a path.
107
+ */
108
+ function resolveDaemonLogsProfile(flags, options = {}) {
109
+ const env = daemonLogsEnv(options);
93
110
  const fromFlag = flags.profile?.trim();
94
- const fromEnv = env.OVERSKY_PROFILE?.trim();
95
- let profile = fromFlag && PROFILE_NAME.test(fromFlag)
96
- ? fromFlag
97
- : fromEnv && PROFILE_NAME.test(fromEnv)
98
- ? fromEnv
99
- : undefined;
100
- if (!profile) {
101
- try {
102
- const pinned = (0, node_fs_1.readFileSync)(node_path_1.default.join(home, '.skrr', 'profile.lock'), 'utf8').trim();
103
- profile = PROFILE_NAME.test(pinned) ? pinned : undefined;
104
- }
105
- catch {
106
- // An absent/corrupt sticky selector must match the daemon's default.
107
- }
111
+ if (fromFlag && (0, auth_core_1.isValidProfileName)(fromFlag))
112
+ return fromFlag;
113
+ try {
114
+ return (0, auth_core_1.resolveProfileSelection)({ env }).profile;
115
+ }
116
+ catch {
117
+ // An invalid OVERSKY_PROFILE: fall to the pin, as the old reader did.
118
+ return (0, auth_core_1.readProfileLock)(env) ?? auth_core_1.DEFAULT_PROFILE;
108
119
  }
109
- return profile ?? 'default';
110
120
  }
111
121
  /**
112
122
  * Read the installed launchd definition's log destinations (OSK-15993). The
@@ -0,0 +1,15 @@
1
+ import { Command } from '@oclif/core';
2
+ /**
3
+ * `skrr daemon profile <subverb> ...` forwards to `skrrd profile`, which owns the
4
+ * profile root: list, current, create, use, clear, doctor, cleanup, trash, restore,
5
+ * purge-trash and remove (OSK-22307). The runtime's recovery hints name this
6
+ * spelling when they were printed through `skrr daemon`, so it has to exist.
7
+ */
8
+ export default class DaemonProfile extends Command {
9
+ static aliases: string[];
10
+ static summary: string;
11
+ static description: string;
12
+ static strict: boolean;
13
+ static examples: string[];
14
+ run(): Promise<void>;
15
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const exec_runtime_binary_1 = require("../../lib/exec-runtime-binary");
5
+ /**
6
+ * `skrr daemon profile <subverb> ...` forwards to `skrrd profile`, which owns the
7
+ * profile root: list, current, create, use, clear, doctor, cleanup, trash, restore,
8
+ * purge-trash and remove (OSK-22307). The runtime's recovery hints name this
9
+ * spelling when they were printed through `skrr daemon`, so it has to exist.
10
+ */
11
+ class DaemonProfile extends core_1.Command {
12
+ // `skrr daemons <sub>` — the plural is advertised as an alias for the
13
+ // whole topic, and without a per-command alias only the bare topic
14
+ // resolved: every subcommand under it failed.
15
+ static aliases = ['daemons:profile'];
16
+ static summary = 'Manage background service profiles: list, create, select, clean up, remove and restore them';
17
+ static description = (0, exec_runtime_binary_1.forwardedFlagsNote)('profile');
18
+ // Positional subverbs (`remove work`) and their flags are skrrd's; with strict off,
19
+ // oclif also stops folding `profile remove` into a command id.
20
+ static strict = false;
21
+ static examples = [
22
+ '<%= config.bin %> daemon profile list',
23
+ '<%= config.bin %> daemon profile remove work',
24
+ '<%= config.bin %> daemon profile remove work --apply',
25
+ '<%= config.bin %> daemon profile trash',
26
+ '<%= config.bin %> daemon profile restore <trash-name>',
27
+ ];
28
+ async run() {
29
+ // `this.argv`, NOT `this.parse()`: `strict = false` relaxes POSITIONAL arity
30
+ // and oclif still rejects any flag this command has not declared, which
31
+ // would make `--apply` and `--json` unreachable (OSK-296).
32
+ const argv = this.argv;
33
+ try {
34
+ // A runtime from before `profile` existed treats an unknown verb as `start`,
35
+ // which collides with a running daemon's singleton. Its help starts nothing.
36
+ if ((await (0, exec_runtime_binary_1.runtimeBinarySupportsSubcommand)('profile')) === false) {
37
+ this.error('The installed skrr background service is older than this skrr CLI and has no ' +
38
+ '`profile` command. Update it with `skrr daemon update`, then rerun this command.', { exit: 2 });
39
+ }
40
+ this.exit(await (0, exec_runtime_binary_1.execRuntimeBinary)(['profile', ...argv]));
41
+ }
42
+ catch (error) {
43
+ if (error.message === 'runtime-binary-not-installed') {
44
+ this.log((0, exec_runtime_binary_1.notInstalledMessage)());
45
+ this.exit(127);
46
+ }
47
+ throw error;
48
+ }
49
+ }
50
+ }
51
+ exports.default = DaemonProfile;
@@ -17,7 +17,7 @@ class GoalsBriefingStatus extends base_command_1.BaseCommand {
17
17
  this.handleApiError(err);
18
18
  }
19
19
  if (flags.json) {
20
- this.log(JSON.stringify(status, null, 2));
20
+ this.printJsonResult(status);
21
21
  return;
22
22
  }
23
23
  this.log(`Morning briefing: ${status.enabled ? 'enabled' : 'disabled'}`);
@@ -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
+ }
@@ -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
- const active = (0, keychain_1.getActiveProfile)() || keychain_1.DEFAULT_PROFILE;
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;
@@ -36,7 +36,7 @@ class TriggersAuthorization extends base_command_1.BaseCommand {
36
36
  this.handleApiError(err);
37
37
  }
38
38
  if (flags.json) {
39
- this.log(JSON.stringify(result, null, 2));
39
+ this.printJsonResult(result);
40
40
  return;
41
41
  }
42
42
  this.log(flags.revoke ? 'Authorization revoked.' : 'Authorization restored.');
@@ -88,7 +88,7 @@ async function readAgentGuide(request, flags) {
88
88
  let source = 'bundled';
89
89
  let reason = flags.offline ? 'offline-requested' : 'no-session';
90
90
  if (!flags.offline) {
91
- (0, keychain_1.setActiveProfile)(flags.profile ?? process.env.OVERSKY_PROFILE ?? '');
91
+ (0, keychain_1.selectActiveProfile)(flags.profile);
92
92
  let credential;
93
93
  let autonomous = false;
94
94
  try {
@@ -6,4 +6,10 @@ import type { AgentCreationDisposition, AgentProactiveBaseline } from '@skrr-ai/
6
6
  * unreadable fact prints as `unknown`, never as missing.
7
7
  */
8
8
  export declare function proactiveBaselineLines(b?: AgentProactiveBaseline | null): string[];
9
+ /**
10
+ * The ceiling is the sum of what the EXPECTED system loops declare, not of the loops
11
+ * that exist. A standby duplicate with 0 of its 5 loops printed "23/day (declared by
12
+ * the system loops)", which read as a budget it was spending (OSK-22353).
13
+ */
14
+ export declare function modelRunCeilingText(b: AgentProactiveBaseline): string;
9
15
  export declare function creationDispositionLines(p?: AgentCreationDisposition | null): string[];