@skrr-ai/cli 0.1.143 → 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.
Files changed (88) hide show
  1. package/README.md +8 -0
  2. package/dist/commands/agenda/trigger/create.js +4 -2
  3. package/dist/commands/agenda/trigger/list.js +7 -7
  4. package/dist/commands/agent/message/approve.d.ts +17 -0
  5. package/dist/commands/agent/message/approve.js +72 -0
  6. package/dist/commands/agent/message/decline.d.ts +17 -0
  7. package/dist/commands/agent/message/decline.js +72 -0
  8. package/dist/commands/agent/message/pending.d.ts +18 -0
  9. package/dist/commands/agent/message/pending.js +79 -0
  10. package/dist/commands/agents/delete.d.ts +45 -0
  11. package/dist/commands/agents/delete.js +139 -2
  12. package/dist/commands/agents/plan-day.d.ts +39 -7
  13. package/dist/commands/agents/plan-day.js +254 -65
  14. package/dist/commands/agents/proactive-audit.d.ts +22 -0
  15. package/dist/commands/agents/proactive-audit.js +86 -0
  16. package/dist/commands/agents/schedule-overview.d.ts +7 -0
  17. package/dist/commands/agents/schedule-overview.js +43 -5
  18. package/dist/commands/agents/schedule-trace.js +30 -19
  19. package/dist/commands/agents/spawn.d.ts +42 -0
  20. package/dist/commands/agents/spawn.js +91 -4
  21. package/dist/commands/agents/todos/list.d.ts +5 -0
  22. package/dist/commands/agents/todos/list.js +19 -5
  23. package/dist/commands/agents/triggers/create.js +1 -1
  24. package/dist/commands/agents/triggers/update.js +1 -1
  25. package/dist/commands/commitments/create.js +13 -3
  26. package/dist/commands/commitments/preflight.js +14 -3
  27. package/dist/commands/initiatives/worker/deactivate.d.ts +23 -0
  28. package/dist/commands/initiatives/worker/deactivate.js +78 -0
  29. package/dist/commands/login.js +8 -2
  30. package/dist/commands/logout.d.ts +20 -0
  31. package/dist/commands/logout.js +110 -5
  32. package/dist/commands/memory/maintain.js +16 -2
  33. package/dist/commands/spaces/delete.js +6 -1
  34. package/dist/commands/spaces/workflows/archive.js +6 -1
  35. package/dist/commands/spaces/workflows/publish.js +3 -1
  36. package/dist/commands/spaces/workflows/run.d.ts +1 -0
  37. package/dist/commands/spaces/workflows/run.js +17 -1
  38. package/dist/commands/spaces/workflows/triggers/create.js +3 -1
  39. package/dist/commands/tasks/workflow-context.js +3 -1
  40. package/dist/commands/triggers/capabilities.js +17 -1
  41. package/dist/commands/triggers/create.d.ts +2 -0
  42. package/dist/commands/triggers/create.js +23 -7
  43. package/dist/commands/triggers/fire-detail.js +12 -3
  44. package/dist/commands/triggers/list.d.ts +1 -0
  45. package/dist/commands/triggers/list.js +13 -1
  46. package/dist/commands/triggers/preflight.js +18 -0
  47. package/dist/commands/triggers/prune.js +9 -5
  48. package/dist/commands/triggers/update.js +13 -4
  49. package/dist/generated/agent-guides.json +35 -35
  50. package/dist/lib/agent-proactive-baseline.js +7 -1
  51. package/dist/lib/commitments.d.ts +16 -9
  52. package/dist/lib/commitments.js +65 -4
  53. package/dist/lib/daemon-setup.js +9 -3
  54. package/dist/lib/daemonBroker.d.ts +7 -0
  55. package/dist/lib/daemonBroker.js +5 -0
  56. package/dist/lib/daemonHandoff.d.ts +2 -0
  57. package/dist/lib/daemonHandoff.js +10 -1
  58. package/dist/lib/daemonIslandProfile.d.ts +19 -0
  59. package/dist/lib/daemonIslandProfile.js +41 -0
  60. package/dist/lib/format.d.ts +32 -0
  61. package/dist/lib/format.js +105 -1
  62. package/dist/lib/initiatives-worker.d.ts +25 -0
  63. package/dist/lib/initiatives-worker.js +13 -0
  64. package/dist/lib/login.d.ts +7 -0
  65. package/dist/lib/login.js +5 -0
  66. package/dist/lib/proactive-audit.d.ts +52 -0
  67. package/dist/lib/proactive-audit.js +67 -0
  68. package/dist/lib/proactiveApi.d.ts +9 -0
  69. package/dist/lib/refresh.d.ts +20 -6
  70. package/dist/lib/refresh.js +27 -9
  71. package/dist/lib/roles.d.ts +1 -1
  72. package/dist/lib/schedule.d.ts +189 -9
  73. package/dist/lib/schedule.js +283 -22
  74. package/dist/lib/triggers.d.ts +134 -3
  75. package/dist/lib/triggers.js +370 -17
  76. package/dist/lib/workflow-node-control.js +8 -0
  77. package/dist/lib/workflow-run-view.js +9 -0
  78. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +1 -1
  79. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +2 -0
  80. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.d.ts +22 -0
  81. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +15 -4
  82. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +1 -1
  83. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +1 -1
  84. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.d.ts +22 -0
  85. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +22 -4
  86. package/dist/node_modules/@skrr-ai/data-provider/index.js +4779 -4741
  87. package/oclif.manifest.json +494 -26
  88. package/package.json +1 -1
@@ -38,6 +38,7 @@ const prompt_1 = require("./prompt");
38
38
  const daemon_command_hint_1 = require("./daemon-command-hint");
39
39
  const daemon_binding_1 = require("./daemon-binding");
40
40
  const daemon_handoff_opt_out_1 = require("./daemon-handoff-opt-out");
41
+ const keychain_1 = require("./keychain");
41
42
  const exec_runtime_binary_1 = require("./exec-runtime-binary");
42
43
  const daemon_installer_1 = require("./daemon-installer");
43
44
  const ssh_detect_1 = require("./ssh-detect");
@@ -91,12 +92,17 @@ async function offerDaemonSetup(opts = {}) {
91
92
  // step. Say which command does it instead.
92
93
  return {
93
94
  status: 'skipped',
94
- detail: 'no terminal to ask — run `skrr daemon install` to set this machine up',
95
+ detail: `no terminal to ask — run \`${(0, daemon_command_hint_1.daemonCommandHint)('install')}\` to set this machine up`,
95
96
  };
96
97
  }
97
98
  const confirmImpl = opts.confirmImpl ?? prompt_1.confirm;
98
99
  log('');
99
- log(` This computer has no ${data_provider_1.BRAND.displayName} background service. It is what lets your agents work here —`);
100
+ // A named profile is a second service on a computer that may already run one,
101
+ // so "this computer has none" would be false there (OSK-22309).
102
+ const profile = (0, keychain_1.getActiveProfile)();
103
+ log(profile && profile !== keychain_1.DEFAULT_PROFILE
104
+ ? ` Profile "${profile}" has no ${data_provider_1.BRAND.displayName} background service on this computer yet. It is what lets your agents work here —`
105
+ : ` This computer has no ${data_provider_1.BRAND.displayName} background service. It is what lets your agents work here —`);
100
106
  log(' running commands, editing files, and driving a browser on this machine.');
101
107
  // Disclose both the safe new-profile default and upgrade compatibility at
102
108
  // the point where the person consents to a persistent local service.
@@ -113,7 +119,7 @@ async function offerDaemonSetup(opts = {}) {
113
119
  if (!yes) {
114
120
  return {
115
121
  status: 'declined',
116
- detail: 'run `skrr daemon install` when you want it',
122
+ detail: `run \`${(0, daemon_command_hint_1.daemonCommandHint)('install')}\` when you want it`,
117
123
  };
118
124
  }
119
125
  // Fetch the signed binary only when there is none. When the binary is already
@@ -89,6 +89,13 @@ export interface DaemonBrokerResult {
89
89
  * the file.
90
90
  */
91
91
  storedIn?: Exclude<AuthBackend, 'none'>;
92
+ /**
93
+ * The descriptor file of the daemon that minted this credential. Which
94
+ * profile's daemon that was is read from it (`daemonIslandProfile.ts`):
95
+ * the broker borrows whichever daemon is running, so it is not always the
96
+ * profile being signed in (OSK-22309).
97
+ */
98
+ descriptorPath?: string;
92
99
  /**
93
100
  * False on the legacy durable-mint shape so `outcome.brokered === true`
94
101
  * narrows the outcome union. A durable mint is never brokered.
@@ -538,6 +538,11 @@ async function attemptDaemonBrokerLoginOnce(opts) {
538
538
  let outcome = null;
539
539
  for (const { bootstrap, sourcePath } of usable) {
540
540
  outcome = await brokerThrough(bootstrap, opts, sourcePath);
541
+ if (outcome.ok && !outcome.descriptorPath) {
542
+ // Which daemon minted it: the caller decides from this whether that daemon
543
+ // is the one the login is for (OSK-22309).
544
+ outcome = { ...outcome, descriptorPath: sourcePath };
545
+ }
541
546
  if (!outcome.ok) {
542
547
  // Say which daemon answered: a guest's refusal has a different repair.
543
548
  outcome = {
@@ -47,6 +47,8 @@ export interface DaemonHandoffOutcome {
47
47
  }
48
48
  export declare function handOffToLocalDaemon(env?: NodeJS.ProcessEnv, opts?: {
49
49
  loginFlow?: string;
50
+ /** With `loginFlow: 'daemon-broker'`: whose daemon brokered it (`CliLoginResult.brokerProfile`). */
51
+ brokerProfile?: string;
50
52
  }): Promise<DaemonHandoffOutcome>;
51
53
  /**
52
54
  * Ask the installed daemon which machine identity it will register `profile`
@@ -197,7 +197,16 @@ async function handOffToLocalDaemon(env = process.env, opts = {}) {
197
197
  // authenticated with, and restarts the process — killing whatever sessions it
198
198
  // was running. `skrr login` on a healthy machine is the path where the least
199
199
  // should happen, and it was the path where the most did.
200
- if (opts.loginFlow === 'daemon-broker') {
200
+ //
201
+ // Only when the daemon that brokered it is THIS profile's (OSK-22309). The
202
+ // broker borrows whichever daemon is running, so `skrr login --profile work`
203
+ // on a computer whose default daemon is up is brokered by `default`: that
204
+ // proves nothing about `work`'s daemon, which usually does not exist yet.
205
+ // Skipping it there meant the command the web gives for "add another profile"
206
+ // signed the CLI in and never set the profile's daemon up. A broker whose
207
+ // descriptor names no profile (a guest's) keeps the old answer.
208
+ if (opts.loginFlow === 'daemon-broker' &&
209
+ (!opts.brokerProfile || opts.brokerProfile === (0, keychain_1.profileForChildProcess)())) {
201
210
  return {
202
211
  status: 'skipped',
203
212
  reason: 'brokered',
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The daemon profile an island descriptor belongs to, read from its path, or
3
+ * null when the path names none (a Dedicated Runtime or Hosted Machine hand-off
4
+ * descriptor, which serves the guest's one daemon).
5
+ *
6
+ * The paths are the ones `resolveBootstrapCandidatePaths` reads:
7
+ * `daemon-island.<profile>.json` on macOS (both config directories),
8
+ * `~/.skrr/profiles/<profile>/daemon-island.json` elsewhere, and
9
+ * `~/.skrr/daemon-island.json` from before profiles had directories.
10
+ *
11
+ * Why it matters: the login broker asks the default profile's candidate list,
12
+ * which falls through to ANY running profile, so a brokered
13
+ * `skrr login --profile work` is usually brokered by `default`. That proves
14
+ * `default`'s daemon is signed in and says nothing about `work`'s (OSK-22309).
15
+ *
16
+ * Its own module, not part of `daemonBroker.ts`, because thirty specs replace
17
+ * that module with a stub and `login.ts` reads this on every brokered login.
18
+ */
19
+ export declare function bootstrapDescriptorProfile(descriptorPath: string | undefined): string | null;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.bootstrapDescriptorProfile = bootstrapDescriptorProfile;
7
+ const node_os_1 = __importDefault(require("node:os"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ /**
10
+ * The daemon profile an island descriptor belongs to, read from its path, or
11
+ * null when the path names none (a Dedicated Runtime or Hosted Machine hand-off
12
+ * descriptor, which serves the guest's one daemon).
13
+ *
14
+ * The paths are the ones `resolveBootstrapCandidatePaths` reads:
15
+ * `daemon-island.<profile>.json` on macOS (both config directories),
16
+ * `~/.skrr/profiles/<profile>/daemon-island.json` elsewhere, and
17
+ * `~/.skrr/daemon-island.json` from before profiles had directories.
18
+ *
19
+ * Why it matters: the login broker asks the default profile's candidate list,
20
+ * which falls through to ANY running profile, so a brokered
21
+ * `skrr login --profile work` is usually brokered by `default`. That proves
22
+ * `default`'s daemon is signed in and says nothing about `work`'s (OSK-22309).
23
+ *
24
+ * Its own module, not part of `daemonBroker.ts`, because thirty specs replace
25
+ * that module with a stub and `login.ts` reads this on every brokered login.
26
+ */
27
+ function bootstrapDescriptorProfile(descriptorPath) {
28
+ if (!descriptorPath)
29
+ return null;
30
+ const base = node_path_1.default.basename(descriptorPath);
31
+ const named = /^daemon-island\.([^.]+)\.json$/.exec(base);
32
+ if (named)
33
+ return named[1];
34
+ if (base !== 'daemon-island.json')
35
+ return null;
36
+ const dir = node_path_1.default.dirname(descriptorPath);
37
+ if (node_path_1.default.basename(node_path_1.default.dirname(dir)) === 'profiles')
38
+ return node_path_1.default.basename(dir);
39
+ const legacy = node_path_1.default.join(node_os_1.default.homedir(), '.skrr', 'daemon-island.json');
40
+ return node_path_1.default.resolve(descriptorPath) === node_path_1.default.resolve(legacy) ? 'default' : null;
41
+ }
@@ -22,6 +22,14 @@ export declare function pad(s: string, width: number): string;
22
22
  * surrogate pair is never split down the middle into two replacement glyphs.
23
23
  */
24
24
  export declare function truncate(s: string, max: number): string;
25
+ /**
26
+ * Truncate in the MIDDLE, keeping both ends: `[df-261102-trig…tion-tc01] text-out`.
27
+ *
28
+ * For a cell whose two ends both carry meaning. A trigger label starts with a run tag and the tag's
29
+ * last characters are what tell two runs apart, so cutting the tail (`truncate`) kept the part they
30
+ * share and dropped the part that differs (OSK-22493).
31
+ */
32
+ export declare function truncateMiddle(s: string, max: number): string;
25
33
  /**
26
34
  * `truncate`, but never in the middle of a word.
27
35
  *
@@ -77,6 +85,8 @@ export type TableColumn<T> = {
77
85
  maxWidth?: number;
78
86
  /** Never clip: the value has to survive intact to be useful. */
79
87
  verbatim?: boolean;
88
+ /** Where a clipped cell loses its text: the end (default) or the middle, keeping both ends. */
89
+ truncate?: 'end' | 'middle';
80
90
  };
81
91
  export declare function renderTable<T extends Record<string, string>>(rows: T[], columns: Array<TableColumn<T>>, log: (line: string) => void): void;
82
92
  /**
@@ -109,6 +119,28 @@ export declare function localTime(value: unknown): string;
109
119
  * rather than print an empty parenthesis.
110
120
  */
111
121
  export declare function localZone(at?: Date): string;
122
+ /**
123
+ * `PST` / `PDT` / `GMT+8` — the short name of `timeZone` at `at`, or an empty
124
+ * string when the runtime cannot name it. Used to label a time that is shown in
125
+ * a zone the reader did not necessarily choose (a plan's own zone).
126
+ */
127
+ export declare function zoneAbbreviation(timeZone: string, at?: Date): string;
128
+ /**
129
+ * One instant rendered in an EXPLICIT IANA zone, with the zone named:
130
+ * `2026-11-02 17:13:40 PST`.
131
+ *
132
+ * `localTime` renders in the machine's zone. A Smart Schedule plan has its own
133
+ * zone, and the instants a plan prints (expiry at the plan day's local midnight,
134
+ * the suggested next run, a trace row) are only readable in THAT zone: printed as
135
+ * raw UTC, `Expires: 2026-11-03T08:00:00.000Z` makes the reader work out that
136
+ * 08:00Z is local midnight, and a trace row at 01:13 UTC reads as an event from
137
+ * tomorrow under a header naming today (OSK-22397). `--json` keeps the raw UTC
138
+ * instant; this is for text only. Never throws: an unparseable value comes back
139
+ * as given, and an unknown zone falls back to UTC, labelled.
140
+ */
141
+ export declare function zonedTime(value: unknown, timeZone: string, options?: {
142
+ seconds?: boolean;
143
+ }): string;
112
144
  export type WhenOptions = {
113
145
  /** The reference instant; injectable so output is deterministic in tests. */
114
146
  now?: Date;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.displayWidth = displayWidth;
4
4
  exports.pad = pad;
5
5
  exports.truncate = truncate;
6
+ exports.truncateMiddle = truncateMiddle;
6
7
  exports.truncateAtWord = truncateAtWord;
7
8
  exports.formatCell = formatCell;
8
9
  exports.collapseWhitespace = collapseWhitespace;
@@ -10,6 +11,8 @@ exports.renderTable = renderTable;
10
11
  exports.localStamp = localStamp;
11
12
  exports.localTime = localTime;
12
13
  exports.localZone = localZone;
14
+ exports.zoneAbbreviation = zoneAbbreviation;
15
+ exports.zonedTime = zonedTime;
13
16
  exports.formatWhen = formatWhen;
14
17
  /**
15
18
  * Code points that occupy TWO terminal columns (Unicode East Asian Wide and
@@ -106,6 +109,46 @@ function truncate(s, max) {
106
109
  }
107
110
  return `${out}…`;
108
111
  }
112
+ /**
113
+ * Truncate in the MIDDLE, keeping both ends: `[df-261102-trig…tion-tc01] text-out`.
114
+ *
115
+ * For a cell whose two ends both carry meaning. A trigger label starts with a run tag and the tag's
116
+ * last characters are what tell two runs apart, so cutting the tail (`truncate`) kept the part they
117
+ * share and dropped the part that differs (OSK-22493).
118
+ */
119
+ function truncateMiddle(s, max) {
120
+ if (displayWidth(s) <= max)
121
+ return s;
122
+ if (max <= 3)
123
+ return truncate(s, max);
124
+ const budget = max - 1; // room for the ellipsis
125
+ const tailBudget = Math.floor(budget / 2);
126
+ const headBudget = budget - tailBudget;
127
+ const widthOf = (ch) => {
128
+ const cp = ch.codePointAt(0) ?? 0;
129
+ return inRanges(cp, ZERO_RANGES) ? 0 : inRanges(cp, WIDE_RANGES) ? 2 : 1;
130
+ };
131
+ let head = '';
132
+ let used = 0;
133
+ for (const ch of s) {
134
+ const w = widthOf(ch);
135
+ if (used + w > headBudget)
136
+ break;
137
+ head += ch;
138
+ used += w;
139
+ }
140
+ const chars = Array.from(s);
141
+ let tail = '';
142
+ used = 0;
143
+ for (let i = chars.length - 1; i >= 0; i -= 1) {
144
+ const w = widthOf(chars[i]);
145
+ if (used + w > tailBudget)
146
+ break;
147
+ tail = chars[i] + tail;
148
+ used += w;
149
+ }
150
+ return `${head}…${tail}`;
151
+ }
109
152
  /**
110
153
  * `truncate`, but never in the middle of a word.
111
154
  *
@@ -216,7 +259,8 @@ function renderTable(rows, columns, log) {
216
259
  const key = String(col.key);
217
260
  const raw = row[key];
218
261
  const width = widths[key];
219
- return pad(col.verbatim ? raw : truncate(raw, width), width);
262
+ const clip = col.truncate === 'middle' ? truncateMiddle : truncate;
263
+ return pad(col.verbatim ? raw : clip(raw, width), width);
220
264
  })
221
265
  .join(' ');
222
266
  log(line);
@@ -289,6 +333,66 @@ function localZone(at = new Date()) {
289
333
  const abs = Math.abs(offset);
290
334
  return `UTC${sign}${`${Math.floor(abs / 60)}`.padStart(2, '0')}:${`${abs % 60}`.padStart(2, '0')}`;
291
335
  }
336
+ /**
337
+ * `PST` / `PDT` / `GMT+8` — the short name of `timeZone` at `at`, or an empty
338
+ * string when the runtime cannot name it. Used to label a time that is shown in
339
+ * a zone the reader did not necessarily choose (a plan's own zone).
340
+ */
341
+ function zoneAbbreviation(timeZone, at = new Date()) {
342
+ try {
343
+ const parts = new Intl.DateTimeFormat('en-US', {
344
+ timeZone,
345
+ timeZoneName: 'short',
346
+ }).formatToParts(at);
347
+ return parts.find((part) => part.type === 'timeZoneName')?.value ?? '';
348
+ }
349
+ catch {
350
+ return '';
351
+ }
352
+ }
353
+ /**
354
+ * One instant rendered in an EXPLICIT IANA zone, with the zone named:
355
+ * `2026-11-02 17:13:40 PST`.
356
+ *
357
+ * `localTime` renders in the machine's zone. A Smart Schedule plan has its own
358
+ * zone, and the instants a plan prints (expiry at the plan day's local midnight,
359
+ * the suggested next run, a trace row) are only readable in THAT zone: printed as
360
+ * raw UTC, `Expires: 2026-11-03T08:00:00.000Z` makes the reader work out that
361
+ * 08:00Z is local midnight, and a trace row at 01:13 UTC reads as an event from
362
+ * tomorrow under a header naming today (OSK-22397). `--json` keeps the raw UTC
363
+ * instant; this is for text only. Never throws: an unparseable value comes back
364
+ * as given, and an unknown zone falls back to UTC, labelled.
365
+ */
366
+ function zonedTime(value, timeZone, options = {}) {
367
+ if (value === null || value === undefined || value === '')
368
+ return '-';
369
+ const date = value instanceof Date ? value : new Date(typeof value === 'number' ? value : String(value));
370
+ if (Number.isNaN(date.getTime()))
371
+ return String(value);
372
+ const seconds = options.seconds !== false;
373
+ const render = (zone) => {
374
+ const parts = new Intl.DateTimeFormat('en-CA', {
375
+ timeZone: zone,
376
+ year: 'numeric',
377
+ month: '2-digit',
378
+ day: '2-digit',
379
+ hour: '2-digit',
380
+ minute: '2-digit',
381
+ second: '2-digit',
382
+ hourCycle: 'h23',
383
+ }).formatToParts(date);
384
+ const get = (type) => parts.find((part) => part.type === type)?.value ?? '00';
385
+ const label = zoneAbbreviation(zone, date) || zone;
386
+ return (`${get('year')}-${get('month')}-${get('day')} ${get('hour')}:${get('minute')}` +
387
+ `${seconds ? `:${get('second')}` : ''} ${label}`);
388
+ };
389
+ try {
390
+ return render(timeZone);
391
+ }
392
+ catch {
393
+ return render('UTC');
394
+ }
395
+ }
292
396
  function zonedParts(date, timeZone) {
293
397
  const parts = new Intl.DateTimeFormat('en-CA', {
294
398
  timeZone,
@@ -0,0 +1,25 @@
1
+ export interface WorkerDeactivateResult {
2
+ agentId: string;
3
+ enabled: false;
4
+ /** One entry per worker watcher kind; `skipped` when the agent has none of that kind. */
5
+ schedules: Array<{
6
+ kind: string;
7
+ skipped?: boolean;
8
+ schedule?: {
9
+ triggerId?: string;
10
+ enabled?: boolean;
11
+ } | null;
12
+ }>;
13
+ initiativeClosure?: {
14
+ skipped?: boolean;
15
+ matched?: number;
16
+ modified?: number;
17
+ };
18
+ }
19
+ export declare const initiativesWorkerApi: {
20
+ deactivate: (input: {
21
+ agentId: string;
22
+ reason?: string;
23
+ closeOpenInitiatives?: boolean;
24
+ }) => Promise<WorkerDeactivateResult>;
25
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initiativesWorkerApi = void 0;
4
+ /**
5
+ * initiatives-worker.ts — client for the worker-wide controls under `/api/initiatives/workers`.
6
+ *
7
+ * The web Control Center had a way to pause an agent's worker; the CLI had none, so a refusal that
8
+ * told a person "change the object that owns it" had no command to point at (OSK-22423).
9
+ */
10
+ const data_provider_1 = require("@skrr-ai/data-provider");
11
+ exports.initiativesWorkerApi = {
12
+ deactivate: (input) => data_provider_1.request.post('/api/initiatives/workers/deactivate', input),
13
+ };
@@ -18,6 +18,13 @@ export interface CliLoginResult {
18
18
  refreshExpiresAt?: number;
19
19
  /** The flow that produced the token; for diagnostics / telemetry. */
20
20
  flow: 'localhost' | 'device-code' | 'refresh-token' | 'daemon-broker';
21
+ /**
22
+ * With `flow: 'daemon-broker'`: the profile of the daemon that brokered it,
23
+ * when its descriptor names one. The broker borrows whichever daemon is
24
+ * running, so after `skrr login --profile work` this is usually `default`, and
25
+ * `work`'s own daemon still needs a credential (OSK-22309).
26
+ */
27
+ brokerProfile?: string;
21
28
  }
22
29
  export interface CliLoginWithRefreshTokenOptions {
23
30
  /** Server base URL. Defaults to config. */
package/dist/lib/login.js CHANGED
@@ -37,6 +37,7 @@ const device_code_1 = require("./device-code");
37
37
  const device_identity_1 = require("./device-identity");
38
38
  const oauthLogin_1 = require("./oauthLogin");
39
39
  const daemonBroker_1 = require("./daemonBroker");
40
+ const daemonIslandProfile_1 = require("./daemonIslandProfile");
40
41
  const dedicated_guest_1 = require("./dedicated-guest");
41
42
  const daemonBrokerRefusal_1 = require("./daemonBrokerRefusal");
42
43
  /**
@@ -122,6 +123,8 @@ async function cliLogin(opts = {}) {
122
123
  baseURL: serverUrl,
123
124
  });
124
125
  if (brokerResult.ok) {
126
+ const brokerProfile = (0, daemonIslandProfile_1.bootstrapDescriptorProfile)(brokerResult.descriptorPath);
127
+ const brokeredBy = brokerProfile ? { brokerProfile } : {};
125
128
  if (brokerResult.brokered) {
126
129
  // Broker-mode hand-off: the daemon served a short-lived access token
127
130
  // from a family IT owns. Nothing credential-shaped is persisted here
@@ -144,6 +147,7 @@ async function cliLogin(opts = {}) {
144
147
  ? { expiresAt: brokerResult.accessExpiresAt }
145
148
  : {}),
146
149
  flow: 'daemon-broker',
150
+ ...brokeredBy,
147
151
  };
148
152
  }
149
153
  console.log('');
@@ -163,6 +167,7 @@ async function cliLogin(opts = {}) {
163
167
  ? { refreshExpiresAt: Date.parse(brokerResult.refreshExpiresAt) }
164
168
  : {}),
165
169
  flow: 'daemon-broker',
170
+ ...brokeredBy,
166
171
  };
167
172
  }
168
173
  // `ci_token_refused` is the one broker failure we surface rather
@@ -0,0 +1,52 @@
1
+ export type ProactiveAuditDomain = 'agent_compass' | 'agent_initiatives' | 'smart_schedule' | 'goal_planner';
2
+ export interface ProactiveAuditEvent {
3
+ id: string;
4
+ domain: string;
5
+ changeType?: string | null;
6
+ actorType?: string | null;
7
+ actorUserId?: string | null;
8
+ actorAgentId?: string | null;
9
+ reason?: string | null;
10
+ summary?: string | null;
11
+ occurredAt?: string | null;
12
+ }
13
+ /** One watcher switch as the run reads it. `default` = the trigger names no value. */
14
+ export interface WatcherSettingValue {
15
+ value: boolean;
16
+ source: 'trigger' | 'default';
17
+ }
18
+ export interface TaskGoalWatcherTrigger {
19
+ triggerId: string;
20
+ label: string | null;
21
+ enabled: boolean;
22
+ taskGoalDeltaMode: WatcherSettingValue;
23
+ crossDomainDedupe: WatcherSettingValue;
24
+ }
25
+ export interface TaskGoalWatcherSettings {
26
+ settings: Record<string, {
27
+ default: boolean;
28
+ meaning: string;
29
+ }>;
30
+ triggers: TaskGoalWatcherTrigger[];
31
+ }
32
+ export interface ProactiveAuditResponse {
33
+ events: ProactiveAuditEvent[];
34
+ taskGoalWatcher?: TaskGoalWatcherSettings;
35
+ }
36
+ export declare function proactiveAuditPath(params: {
37
+ agentId: string;
38
+ domain?: ProactiveAuditDomain;
39
+ limit?: number;
40
+ }): string;
41
+ export declare const proactiveAuditApi: {
42
+ read: (params: {
43
+ agentId: string;
44
+ domain?: ProactiveAuditDomain;
45
+ limit?: number;
46
+ }) => Promise<ProactiveAuditResponse>;
47
+ };
48
+ /**
49
+ * The text form of the watcher block: for each switch, its effective value, where it comes from, and
50
+ * what it does. Pure, so what a reader is told is pinned by a spec rather than by a run.
51
+ */
52
+ export declare function renderTaskGoalWatcherSettings(watcher: TaskGoalWatcherSettings | undefined, log: (line: string) => void): void;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.proactiveAuditApi = void 0;
4
+ exports.proactiveAuditPath = proactiveAuditPath;
5
+ exports.renderTaskGoalWatcherSettings = renderTaskGoalWatcherSettings;
6
+ /**
7
+ * proactive-audit.ts — client for `GET /api/todos/proactive-audit`: the cross-domain
8
+ * "who changed this agent's proactivity boundary, when, why" ledger, plus the two switches the
9
+ * agent's task/goal watcher runs with.
10
+ *
11
+ * The route shipped with the web client's types only, so a headless owner could read neither the
12
+ * ledger nor `crossDomainDedupe`, and a watcher run printing `"crossDomainDedupe": true` could not
13
+ * be told apart from a setting someone chose (OSK-22418).
14
+ */
15
+ const data_provider_1 = require("@skrr-ai/data-provider");
16
+ const triggers_1 = require("./triggers");
17
+ function proactiveAuditPath(params) {
18
+ return (0, triggers_1.withQuery)('/api/todos/proactive-audit', {
19
+ agentId: params.agentId,
20
+ domain: params.domain,
21
+ limit: params.limit,
22
+ });
23
+ }
24
+ exports.proactiveAuditApi = {
25
+ read: (params) => data_provider_1.request.get(proactiveAuditPath(params)),
26
+ };
27
+ const SETTING_LABELS = [
28
+ ['taskGoalDeltaMode', 'Only new pressure (delta mode)'],
29
+ ['crossDomainDedupe', 'One voice (cross-domain dedupe)'],
30
+ ];
31
+ function describeSetting(setting) {
32
+ const state = setting.value ? 'on' : 'off';
33
+ return setting.source === 'trigger'
34
+ ? `${state} (set on the watcher trigger)`
35
+ : `${state} (platform default; the watcher trigger sets no value)`;
36
+ }
37
+ /**
38
+ * The text form of the watcher block: for each switch, its effective value, where it comes from, and
39
+ * what it does. Pure, so what a reader is told is pinned by a spec rather than by a run.
40
+ */
41
+ function renderTaskGoalWatcherSettings(watcher, log) {
42
+ if (!watcher) {
43
+ log('Task/goal watcher settings were not returned (a read failure, or a server older than this field); the ledger above is unaffected.');
44
+ return;
45
+ }
46
+ if (watcher.triggers.length === 0) {
47
+ log('Task/goal watcher: none installed on this agent, so no run reads these switches.');
48
+ for (const [key, label] of SETTING_LABELS) {
49
+ const info = watcher.settings[key];
50
+ if (info)
51
+ log(` ${label}: ${info.default ? 'on' : 'off'} by default - ${info.meaning}`);
52
+ }
53
+ return;
54
+ }
55
+ for (const trigger of watcher.triggers) {
56
+ log(`Task/goal watcher ${trigger.triggerId}${trigger.label ? ` (${trigger.label})` : ''}` +
57
+ ` - ${trigger.enabled ? 'enabled' : 'disabled'}`);
58
+ for (const [key, label] of SETTING_LABELS) {
59
+ log(` ${label}: ${describeSetting(trigger[key])}`);
60
+ const meaning = watcher.settings[key]?.meaning;
61
+ if (meaning)
62
+ log(` ${meaning}`);
63
+ }
64
+ }
65
+ log('These are not settable from the CLI: a worker watcher belongs to the platform, and a run');
66
+ log('echoes the effective values in its counts (`skrr agents triggers runs <agent> <trigger>`).');
67
+ }
@@ -109,6 +109,9 @@ export interface ApplyProactiveAgentResponse {
109
109
  source: string;
110
110
  ok: boolean;
111
111
  code?: string;
112
+ /** The trigger the watcher became; absent on a failure or an older server. */
113
+ triggerId?: string;
114
+ enabled?: boolean;
112
115
  }>;
113
116
  };
114
117
  alwaysOn?: {
@@ -127,6 +130,12 @@ export interface ApplyProactiveAgentResponse {
127
130
  skipped?: string;
128
131
  code?: string;
129
132
  };
133
+ /** Where the apply put a new Agent, when it chose (the owner's own Codex machine). */
134
+ runsOn?: {
135
+ kind: string;
136
+ harnessId?: string;
137
+ label?: string;
138
+ };
130
139
  orchestrator?: {
131
140
  ok: boolean;
132
141
  status?: string;
@@ -15,7 +15,7 @@
15
15
  * don't rotate; the caller is expected to `classifyTokenKind()` and
16
16
  * skip this module entirely when `kind === 'ci'`.
17
17
  */
18
- import { PermanentAuthFailure, TransientAuthFailure, type ResolvedCredential, type TokenPair } from '@skrr-ai/auth-core';
18
+ import { PermanentAuthFailure, TransientAuthFailure, type RefreshRevokeResult, type ResolvedCredential, type TokenPair } from '@skrr-ai/auth-core';
19
19
  export declare const CLI_REFRESH_EARLY_MS: number;
20
20
  /**
21
21
  * Stable origin header so the server's benign-grace matcher can identify
@@ -78,11 +78,25 @@ export declare function ensureFreshCliCredential(opts?: EnsureFreshCliCredential
78
78
  */
79
79
  export declare function refreshCliToken(): Promise<TokenPair>;
80
80
  /**
81
- * Best-effort revoke. Does NOT clear local backends — callers want to
82
- * stage the server revoke before nuking the local bundle so the server
83
- * accepts the request (revoke is authenticated by the refresh token
84
- * itself, which we're about to discard).
81
+ * What revoking this profile's CLI session came to. The server's three answers
82
+ * (`accepted`, `refused`, `unreachable`), or `not_sent` when there was nothing
83
+ * this computer could present: no sign-in stored for this server, one with no
84
+ * refresh half, or one that could not be read.
85
85
  */
86
- export declare function revokeCurrentRefreshToken(): Promise<void>;
86
+ export type CliSessionRevokeResult = RefreshRevokeResult | {
87
+ outcome: 'not_sent';
88
+ reason: 'no_credential' | 'no_refresh_token' | 'read_failed';
89
+ detail?: string;
90
+ };
91
+ /**
92
+ * Revoke this profile's CLI session on the server, and say what happened.
93
+ * Does NOT clear local backends: the revoke is authenticated by the refresh
94
+ * token itself, so the caller stages it before discarding the bundle.
95
+ *
96
+ * It used to return nothing and swallow every failure, so `skrr logout`
97
+ * printed "Signed out." over a session the server never heard about
98
+ * (OSK-22307). It never throws.
99
+ */
100
+ export declare function revokeCurrentRefreshToken(): Promise<CliSessionRevokeResult>;
87
101
  export { PermanentAuthFailure, TransientAuthFailure };
88
102
  export type { TokenPair };