@skrr-ai/cli 0.1.141 → 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 (85) 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 +127 -7
  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/spaces/heartbeats/create.js +1 -1
  32. package/dist/commands/spaces/heartbeats/update.js +1 -1
  33. package/dist/commands/triggers/authorization.js +1 -1
  34. package/dist/lib/agent-guides.js +1 -1
  35. package/dist/lib/agent-proactive-baseline.d.ts +6 -0
  36. package/dist/lib/agent-proactive-baseline.js +25 -2
  37. package/dist/lib/always-on-command-result.d.ts +18 -0
  38. package/dist/lib/always-on-command-result.js +52 -0
  39. package/dist/lib/always-on-runtime.d.ts +31 -0
  40. package/dist/lib/always-on-runtime.js +39 -0
  41. package/dist/lib/auth-diagnostics.d.ts +10 -1
  42. package/dist/lib/auth-diagnostics.js +16 -8
  43. package/dist/lib/compasses.js +5 -0
  44. package/dist/lib/daemon-binding.js +6 -3
  45. package/dist/lib/daemon-command-hint.d.ts +10 -5
  46. package/dist/lib/daemon-command-hint.js +11 -6
  47. package/dist/lib/daemonHandoff.js +6 -2
  48. package/dist/lib/drain-stdio.d.ts +22 -0
  49. package/dist/lib/drain-stdio.js +46 -0
  50. package/dist/lib/keychain.d.ts +22 -1
  51. package/dist/lib/keychain.js +40 -1
  52. package/dist/lib/local-daemon-readiness.js +4 -6
  53. package/dist/lib/local-skills.js +4 -1
  54. package/dist/lib/machines.d.ts +68 -0
  55. package/dist/lib/machines.js +67 -0
  56. package/dist/lib/proactiveApi.d.ts +15 -1
  57. package/dist/lib/runtime-start-verification.js +3 -6
  58. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/configRoot.d.ts +12 -0
  59. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/configRoot.js +10 -2
  60. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.d.ts +8 -0
  61. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +22 -0
  62. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/executorStopReceiptV2.d.ts +133 -0
  63. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/executorStopReceiptV2.js +180 -0
  64. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +4 -2
  65. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +48 -0
  66. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profilePorts.d.ts +137 -0
  67. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profilePorts.js +328 -0
  68. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileSelection.d.ts +63 -0
  69. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileSelection.js +174 -0
  70. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/configRoot.d.ts +12 -0
  71. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/configRoot.js +14 -0
  72. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.d.ts +8 -0
  73. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +27 -0
  74. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/executorStopReceiptV2.d.ts +133 -0
  75. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/executorStopReceiptV2.js +183 -0
  76. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +4 -2
  77. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +10 -2
  78. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profilePorts.d.ts +137 -0
  79. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profilePorts.js +333 -0
  80. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileSelection.d.ts +63 -0
  81. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileSelection.js +212 -0
  82. package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
  83. package/dist/node_modules/@skrr-ai/data-provider/index.js +7295 -7265
  84. package/oclif.manifest.json +332 -3
  85. package/package.json +1 -1
@@ -587,8 +587,10 @@ export declare function describeGitHubUnavailable(): string;
587
587
  *
588
588
  * `GET /api/tasks` answers 503 with this code when its one aggregate is cut off at `maxTimeMS`,
589
589
  * which an unscoped list over every accessible Space reaches because no index serves its sort
590
- * across the access filter. Lead with the server's `cause`/`remedy`, falling back to the CLI's
591
- * own sentence: the 5xx redaction boundary generalizes a bare message in production.
590
+ * across the access filter. A list the caller already narrowed can reach it too, and then the
591
+ * server says the delay is its own and sets `retryable: true` (OSK-22297). Lead with the
592
+ * server's `cause`/`remedy`, falling back to the CLI's own sentence for the case `retryable`
593
+ * names: the 5xx redaction boundary generalizes a bare message in production.
592
594
  *
593
595
  * Exported for tests.
594
596
  */
@@ -72,6 +72,7 @@ const refresh_1 = require("./lib/refresh");
72
72
  const auth_storage_1 = require("./lib/auth-storage");
73
73
  const web_url_1 = require("./lib/web-url");
74
74
  const edge_error_page_1 = require("./lib/edge-error-page");
75
+ const drain_stdio_1 = require("./lib/drain-stdio");
75
76
  const step_up_1 = require("./lib/step-up");
76
77
  const delegated_cli_1 = require("./lib/delegated-cli");
77
78
  const dedicated_guest_1 = require("./lib/dedicated-guest");
@@ -333,7 +334,17 @@ class BaseCommand extends core_1.Command {
333
334
  // `preAction` hook; oclif has no equivalent that beats `init()`, so this
334
335
  // scans argv itself. The flag is still declared in `baseFlags` above, which
335
336
  // is what puts it in `--help` and keeps oclif from rejecting it.
336
- (0, keychain_2.setActiveProfile)((0, keychain_2.resolveProfileFromArgv)(this.argv) ?? process.env.OVERSKY_PROFILE ?? '');
337
+ //
338
+ // The rule is the daemon's, read from one function (OSK-22299):
339
+ // --profile > OVERSKY_PROFILE > <root>/profile.lock > default. The CLI used
340
+ // to skip the lock, so after `skrrd profile use work` the two binaries
341
+ // acted on different profiles from the same shell.
342
+ try {
343
+ (0, keychain_2.selectActiveProfile)((0, keychain_2.resolveProfileFromArgv)(this.argv));
344
+ }
345
+ catch (err) {
346
+ this.error(err.message, { exit: 64 });
347
+ }
337
348
  // A daemon-stamped autonomous process is a separate principal, not a
338
349
  // convenient place to inherit the user's CLI login. Resolve this before
339
350
  // touching migration, Keychain/file auth, refresh, or daemon auto-broker
@@ -1348,6 +1359,7 @@ class BaseCommand extends core_1.Command {
1348
1359
  managedRuntime: this.authManagedRuntime,
1349
1360
  baseURL: this.cliConfig?.baseURL,
1350
1361
  bin: this.config?.bin ?? 'skrr',
1362
+ profile: (0, keychain_2.getActiveProfileSelection)(),
1351
1363
  });
1352
1364
  }
1353
1365
  async catch(err) {
@@ -1359,6 +1371,12 @@ class BaseCommand extends core_1.Command {
1359
1371
  process.exitCode = err.oclif?.exit ?? 1;
1360
1372
  return;
1361
1373
  }
1374
+ // Every other `this.exit(n)` is a command that printed its own result and
1375
+ // then chose its status (`triggers fire --strict --json`, `widgets check`,
1376
+ // `search all`, ...). It still reaches that immediate exit, so hand what
1377
+ // it printed to the OS first or a piped reader gets 64 KiB of it
1378
+ // (OSK-22165).
1379
+ await (0, drain_stdio_1.drainStdio)();
1362
1380
  return super.catch(err);
1363
1381
  }
1364
1382
  // Canonical Task Model v1 removed several `tasks complete` flags outright,
@@ -1431,6 +1449,9 @@ class BaseCommand extends core_1.Command {
1431
1449
  if (!err.message.includes(line))
1432
1450
  err.message = `${err.message}\n\n${line}`;
1433
1451
  }
1452
+ // `super.catch` rethrows into oclif's `handle`, which exits immediately:
1453
+ // anything the command printed before failing must leave the process first.
1454
+ await (0, drain_stdio_1.drainStdio)();
1434
1455
  return super.catch(err);
1435
1456
  }
1436
1457
  error(input, options = {}) {
@@ -1582,16 +1603,20 @@ class BaseCommand extends core_1.Command {
1582
1603
  });
1583
1604
  }
1584
1605
  else if (bodyCode === 'TASK_LIST_TIMEOUT') {
1585
- // The list was too broad for the database's time limit — a 503 the API sent on purpose,
1586
- // with the narrower question to ask. The outage branch below would say skrr is down,
1587
- // record an incident, and tell an agent to retry the very query that cannot finish
1588
- // (OSK-21284).
1606
+ // The database cut the list off at its time limit — a 503 the API sent on purpose. For an
1607
+ // unscoped list that means too broad a question, and the body names the narrower one: the
1608
+ // outage branch below would say skrr is down, record an incident, and tell an agent to
1609
+ // retry the very query that cannot finish (OSK-21284). For a list the caller already
1610
+ // narrowed the server says the delay is its own and sets `retryable: true` (OSK-22297);
1611
+ // retrying IS the remedy then, so that verdict and the retryable exit code follow the body.
1612
+ // Neither is an outage, so neither records an incident.
1613
+ const retryable = body?.retryable === true;
1589
1614
  this.failWithCliError({
1590
1615
  message: say(describeTaskListTimeout(body, this.config.bin)),
1591
1616
  code: bodyCode,
1592
1617
  status: e.status,
1593
- exit: 1,
1594
- retryable: false,
1618
+ exit: retryable ? 5 : 1,
1619
+ retryable,
1595
1620
  details: envelopeDetails(body),
1596
1621
  });
1597
1622
  }
@@ -2451,18 +2476,26 @@ function describeGitHubUnavailable() {
2451
2476
  *
2452
2477
  * `GET /api/tasks` answers 503 with this code when its one aggregate is cut off at `maxTimeMS`,
2453
2478
  * which an unscoped list over every accessible Space reaches because no index serves its sort
2454
- * across the access filter. Lead with the server's `cause`/`remedy`, falling back to the CLI's
2455
- * own sentence: the 5xx redaction boundary generalizes a bare message in production.
2479
+ * across the access filter. A list the caller already narrowed can reach it too, and then the
2480
+ * server says the delay is its own and sets `retryable: true` (OSK-22297). Lead with the
2481
+ * server's `cause`/`remedy`, falling back to the CLI's own sentence for the case `retryable`
2482
+ * names: the 5xx redaction boundary generalizes a bare message in production.
2456
2483
  *
2457
2484
  * Exported for tests.
2458
2485
  */
2459
2486
  function describeTaskListTimeout(body, bin = 'skrr') {
2487
+ const retryable = body?.retryable === true;
2460
2488
  const cause = stringProp(body, 'cause') ||
2461
- 'The task list took too long: it spans every task you can see across all your workspaces and ' +
2462
- 'Spaces, and the database could not return the newest page within its time limit.';
2489
+ (retryable
2490
+ ? 'The task list took too long: the database did not return the page within its time limit, ' +
2491
+ 'and the delay is not in the request.'
2492
+ : 'The task list took too long: it spans every task you can see across all your workspaces and ' +
2493
+ 'Spaces, and the database could not return the newest page within its time limit.');
2463
2494
  const remedy = stringProp(body, 'remedy') ||
2464
- `Name where to look: a workspace (\`${bin} workspaces use <workspace-id>\`, or \`--workspace <workspace-id>\`) ` +
2465
- `or a Space (\`${bin} tasks list --space <space-id>\`).`;
2495
+ (retryable
2496
+ ? 'Try again in a moment with the same request.'
2497
+ : `Name where to look: a workspace (\`${bin} workspaces use <workspace-id>\`, or \`--workspace <workspace-id>\`) ` +
2498
+ `or a Space (\`${bin} tasks list --space <space-id>\`).`);
2466
2499
  return `${cause}\n → ${remedy}`;
2467
2500
  }
2468
2501
  /**
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const base_command_1 = require("../../../base-command");
6
+ const always_on_command_result_1 = require("../../../lib/always-on-command-result");
6
7
  /**
7
8
  * `skrr agents always-on disable <agent-id>` — flip the desired Boolean to off
8
9
  * via the single control endpoint (`PUT /api/agents/:id/always-on`).
@@ -44,11 +45,18 @@ class AgentsAlwaysOnDisable extends base_command_1.BaseCommand {
44
45
  catch (err) {
45
46
  this.handleApiError(err);
46
47
  }
48
+ const result = (0, always_on_command_result_1.alwaysOnCommandResult)(false, status);
47
49
  if (flags.json) {
48
50
  this.log(JSON.stringify(status, null, 2));
51
+ // The envelope carries `desiredEnabled` and `controlCommand`; the exit
52
+ // code says whether the Agent ended off, so a script need not parse it.
53
+ if (!result.matched)
54
+ this.exit(1);
49
55
  return;
50
56
  }
51
- this.log(`Always-On disabled — generation=${status.generation} operational=${status.operationalState}`);
57
+ this.log(result.line);
58
+ if (!result.matched)
59
+ this.exit(1);
52
60
  if (status.operationalState === 'cancelling') {
53
61
  this.log('Note: active Runs are still draining. Re-run `always-on status` to observe the transition to `off`.');
54
62
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const base_command_1 = require("../../../base-command");
6
+ const always_on_command_result_1 = require("../../../lib/always-on-command-result");
6
7
  /**
7
8
  * `skrr agents always-on enable <agent-id>` — flip the desired Boolean to on
8
9
  * via the single control endpoint (`PUT /api/agents/:id/always-on`).
@@ -52,11 +53,18 @@ class AgentsAlwaysOnEnable extends base_command_1.BaseCommand {
52
53
  catch (err) {
53
54
  this.handleApiError(err);
54
55
  }
56
+ const result = (0, always_on_command_result_1.alwaysOnCommandResult)(true, status);
55
57
  if (flags.json) {
56
58
  this.log(JSON.stringify(status, null, 2));
59
+ // The envelope carries `desiredEnabled` and `controlCommand`; the exit
60
+ // code says whether the Agent ended on, so a script need not parse it.
61
+ if (!result.matched)
62
+ this.exit(1);
57
63
  return;
58
64
  }
59
- this.log(`Always-On enabled — generation=${status.generation} operational=${status.operationalState}`);
65
+ this.log(result.line);
66
+ if (!result.matched)
67
+ this.exit(1);
60
68
  if (status.operationalState === 'needs_setup') {
61
69
  this.log('Note: no Commitment or managed producer lane exists yet. Create a Commitment (or convert a legacy heartbeat) so the runtime has something to fire.');
62
70
  }
@@ -4,6 +4,7 @@ const core_1 = require("@oclif/core");
4
4
  const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const base_command_1 = require("../../../base-command");
6
6
  const agent_proactive_baseline_1 = require("../../../lib/agent-proactive-baseline");
7
+ const always_on_runtime_1 = require("../../../lib/always-on-runtime");
7
8
  /**
8
9
  * `skrr agents always-on status <agent-id>` — read the composed generation-aware
9
10
  * Always-On status envelope via the single control endpoint
@@ -36,6 +37,16 @@ class AgentsAlwaysOnStatus extends base_command_1.BaseCommand {
36
37
  catch (err) {
37
38
  this.handleApiError(err);
38
39
  }
40
+ // The envelope says what the platform means to fire, not whether the machine
41
+ // that work runs on is reachable (OSK-22347). Read it from the Agent, as the
42
+ // web does; a failed read is `unknown`, never a silently absent line.
43
+ let runtime;
44
+ try {
45
+ runtime = (0, always_on_runtime_1.runtimeFromAgent)(await data_provider_1.dataService.getAgentById({ agent_id: args.id }));
46
+ }
47
+ catch {
48
+ runtime = always_on_runtime_1.RUNTIME_READ_FAILED;
49
+ }
39
50
  // This endpoint authorizes and resolves by Agent ID. Its messaging scope is
40
51
  // built from the Agent's own workspace, which can differ from the global
41
52
  // workspace header supplied by the caller.
@@ -52,7 +63,7 @@ class AgentsAlwaysOnStatus extends base_command_1.BaseCommand {
52
63
  }
53
64
  : null;
54
65
  if (flags.json) {
55
- this.log(JSON.stringify(workspaceSelection ? { ...status, workspaceSelection } : status, null, 2));
66
+ this.log(JSON.stringify({ ...status, agentRuntime: runtime, ...(workspaceSelection ? { workspaceSelection } : {}) }, null, 2));
56
67
  return;
57
68
  }
58
69
  this.log(`Agent: ${args.id}`);
@@ -65,6 +76,8 @@ class AgentsAlwaysOnStatus extends base_command_1.BaseCommand {
65
76
  this.log(`Desired: ${status.desiredEnabled ? 'on' : 'off'}`);
66
77
  this.log(`Generation: ${status.generation}`);
67
78
  this.log(`Operational: ${status.operationalState}`);
79
+ for (const line of (0, always_on_runtime_1.runtimeLines)(runtime, status.desiredEnabled))
80
+ this.log(line);
68
81
  this.log(`Reconcile: ${status.reconcile.status}` +
69
82
  (status.reconcile.lastError ? ` (${status.reconcile.lastError})` : ''));
70
83
  this.log(`Managed triggers: ${status.reconcile.managedTriggerCount}` +
@@ -138,17 +138,26 @@ function backgroundLoopLines(agentId, relationshipLoopsSkipped, initialAlwaysOn
138
138
  ];
139
139
  if (!initialAlwaysOn)
140
140
  return [
141
- 'Passive creation acknowledged. Legacy task/memory scans were omitted. Explicit chats still run; Always-On can enable the seeded managed portfolio later.',
141
+ // Plain words for what exists: a policy, a Compass and the daily self-reflection
142
+ // check are seeded even for a passive Agent, and nothing runs until Always-On is on
143
+ // (OSK-22360; "legacy scans" and "managed portfolio" were internal terms).
144
+ 'Passive creation acknowledged: Always-On is off, so nothing runs on its own yet. A policy, a Compass and a daily self-reflection check were seeded, and the scheduled task/goal and memory scans were omitted. Explicit chats still run; Always-On can switch the seeded loops on later.',
142
145
  ` skrr agents always-on enable ${agentId} # start autonomous work later`,
143
146
  ];
147
+ const alwaysOnLines = [
148
+ 'Always-On: on. This agent starts working on its own as soon as it is set up.',
149
+ ` skrr agents always-on disable ${agentId} # turn it off`,
150
+ ];
144
151
  if (relationshipLoopsSkipped) {
145
152
  return [
153
+ ...alwaysOnLines,
146
154
  'Background loops: relationship portfolio skipped (--no-relationship-loops). ' +
147
155
  'Self-reflection is still seeded and runs on its own cadence.',
148
156
  ` skrr commitments list --agent ${agentId} --include-system # what it still runs`,
149
157
  ];
150
158
  }
151
159
  return [
160
+ ...alwaysOnLines,
152
161
  'Background loops: this agent is being enrolled in system-managed commitments — ' +
153
162
  'self-reflection, conversation continuity, relationship pulse, commitment incubator ' +
154
163
  'and open-loop closer. They run on their own cadence, unprompted, and are hidden ' +
@@ -16,6 +16,12 @@ export declare function agentRemovalReport(agentId: string, response: DeleteAgen
16
16
  * nothing (an older server, or an uninstall, which erases nothing).
17
17
  */
18
18
  export declare function agentErasureReport(response: DeleteAgentResponse | undefined): string[];
19
+ /**
20
+ * What stays behind: Goals the Agent owned and open Tasks assigned to it. They are the owner's own
21
+ * work, so deleting the Agent does not remove them, and until now the receipt never said so
22
+ * (OSK-22342).
23
+ */
24
+ export declare function agentRetainedReport(response: DeleteAgentResponse | undefined, bin?: string): string[];
19
25
  export default class AgentsDelete extends BaseCommand {
20
26
  static description: string;
21
27
  static examples: string[];
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.agentRemovalQuestion = agentRemovalQuestion;
4
4
  exports.agentRemovalReport = agentRemovalReport;
5
5
  exports.agentErasureReport = agentErasureReport;
6
+ exports.agentRetainedReport = agentRetainedReport;
6
7
  const core_1 = require("@oclif/core");
7
8
  const data_provider_1 = require("@skrr-ai/data-provider");
8
9
  const base_command_1 = require("../../base-command");
@@ -52,6 +53,27 @@ function agentErasureReport(response) {
52
53
  const erasure = response && 'erasure' in response ? response.erasure : undefined;
53
54
  return (0, data_provider_1.describePersonalContextErasure)(erasure)?.lines ?? [];
54
55
  }
56
+ /**
57
+ * What stays behind: Goals the Agent owned and open Tasks assigned to it. They are the owner's own
58
+ * work, so deleting the Agent does not remove them, and until now the receipt never said so
59
+ * (OSK-22342).
60
+ */
61
+ function agentRetainedReport(response, bin = 'skrr') {
62
+ if ((0, data_provider_1.agentRemovalKind)(response) !== 'deleted')
63
+ return [];
64
+ const retained = response && 'retained' in response ? response.retained : undefined;
65
+ if (!retained || (retained.goals <= 0 && retained.openTasks <= 0))
66
+ return [];
67
+ const noun = (count, word) => `${count} ${word}${count === 1 ? '' : 's'}`;
68
+ const parts = [
69
+ ...(retained.goals > 0 ? [noun(retained.goals, 'goal')] : []),
70
+ ...(retained.openTasks > 0 ? [noun(retained.openTasks, 'open task')] : []),
71
+ ];
72
+ return [
73
+ `Left in place: ${parts.join(' and ')} that this agent owned or was assigned. They are yours, so deleting the agent did not remove them, and they still name it.`,
74
+ ` Archive or reassign them with \`${bin} goals archive <goal-id>\` and \`${bin} tasks\`.`,
75
+ ];
76
+ }
55
77
  class AgentsDelete extends base_command_1.BaseCommand {
56
78
  static description = 'Delete an agent you created (irreversible), or uninstall one installed from the store (reinstalling restores it)';
57
79
  static examples = [
@@ -105,6 +127,8 @@ class AgentsDelete extends base_command_1.BaseCommand {
105
127
  this.log(agentRemovalReport(args.id, response));
106
128
  for (const line of agentErasureReport(response))
107
129
  this.log(line);
130
+ for (const line of agentRetainedReport(response, this.config.bin))
131
+ this.log(line);
108
132
  }
109
133
  }
110
134
  exports.default = AgentsDelete;
@@ -21,7 +21,7 @@ class AgentsIntuitionsList extends base_command_1.BaseCommand {
21
21
  this.log(`No active intuitions. Run skrr agents intuitions generate ${args.agentId} to look for suggestions.`);
22
22
  }
23
23
  else {
24
- this.log(JSON.stringify(intuitions, null, 2));
24
+ this.printJsonResult(intuitions);
25
25
  }
26
26
  this.printAgentUrl(args.agentId);
27
27
  }
@@ -8,6 +8,15 @@ export type ProactiveInstallReadiness = {
8
8
  export declare function workerPolicyWindowLines(policy: NonNullable<ProactiveAgentSpec['worker']>['policy']): string[];
9
9
  /** JSON previews show the effective disabled state without mutating the input spec. */
10
10
  export declare function specWithEffectiveWindowFlags(spec: ProactiveAgentSpec): ProactiveAgentSpec;
11
+ /** A value as one POSIX shell word, so a printed command can be pasted as it is. */
12
+ export declare function shellQuote(value: string): string;
13
+ /**
14
+ * One line for the goals, tasks and jobs a spec seeded. The text receipt printed
15
+ * the worker and the orchestrator and nothing of these, though `--json` listed
16
+ * them, so a person reading the text never learned that work had been created
17
+ * for them (OSK-22358).
18
+ */
19
+ export declare function initializeSummary(initialize: NonNullable<ApplyProactiveAgentResponse['installed']['initialize']> | undefined): string | null;
11
20
  /**
12
21
  * Agent identity creation is intentionally forward-only, but an Agent URL must
13
22
  * not masquerade as a fully installed proactive service when a watcher or
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.workerPolicyWindowLines = workerPolicyWindowLines;
4
4
  exports.specWithEffectiveWindowFlags = specWithEffectiveWindowFlags;
5
+ exports.shellQuote = shellQuote;
6
+ exports.initializeSummary = initializeSummary;
5
7
  exports.proactiveInstallReadiness = proactiveInstallReadiness;
6
8
  const core_1 = require("@oclif/core");
7
9
  const base_command_1 = require("../../base-command");
@@ -43,6 +45,33 @@ function specWithEffectiveWindowFlags(spec) {
43
45
  },
44
46
  };
45
47
  }
48
+ /** A value as one POSIX shell word, so a printed command can be pasted as it is. */
49
+ function shellQuote(value) {
50
+ return `'${value.replace(/'/g, `'\\''`)}'`;
51
+ }
52
+ /**
53
+ * One line for the goals, tasks and jobs a spec seeded. The text receipt printed
54
+ * the worker and the orchestrator and nothing of these, though `--json` listed
55
+ * them, so a person reading the text never learned that work had been created
56
+ * for them (OSK-22358).
57
+ */
58
+ function initializeSummary(initialize) {
59
+ if (!initialize)
60
+ return null;
61
+ const noun = (count, word) => `${count} ${word}${count === 1 ? '' : 's'}`;
62
+ const goals = initialize.goals.filter((item) => item.ok);
63
+ const tasks = initialize.tasks.filter((item) => item.ok);
64
+ const jobs = initialize.jobs.filter((item) => item.ok);
65
+ const failed = initialize.goals.length + initialize.tasks.length + initialize.jobs.length -
66
+ goals.length - tasks.length - jobs.length;
67
+ if (!goals.length && !tasks.length && !jobs.length && !failed)
68
+ return null;
69
+ const parts = [noun(goals.length, 'goal'), noun(tasks.length, 'task'), noun(jobs.length, 'scheduled job')];
70
+ const existing = [...goals, ...tasks].filter((item) => item.existing).length;
71
+ return (parts.join(', ') +
72
+ (existing ? ` (${existing} already existed)` : '') +
73
+ (failed ? `; ${failed} could not be created` : ''));
74
+ }
46
75
  /**
47
76
  * Agent identity creation is intentionally forward-only, but an Agent URL must
48
77
  * not masquerade as a fully installed proactive service when a watcher or
@@ -54,10 +83,40 @@ function proactiveInstallReadiness(result, bin) {
54
83
  return { status: 'ready', message: 'All requested setup steps completed.' };
55
84
  }
56
85
  if (result.warnings.some((warning) => warning.step.startsWith('commitment.'))) {
57
- const affected = (result.installed.commitments || []).filter((commitment) => commitment.status !== 'active' || result.warnings.some((warning) => warning.step === `commitment.${commitment.title}`));
86
+ // A Commitment the owner deleted is reported, not repaired: it was not recreated on
87
+ // purpose, and a repair command that names its id is a dead end (OSK-22381).
88
+ const deleted = (result.installed.commitments || []).filter((commitment) => commitment.status === 'deleted');
89
+ const affected = (result.installed.commitments || []).filter((commitment) => commitment.status !== 'deleted' && (commitment.status !== 'active' || result.warnings.some((warning) => warning.step === `commitment.${commitment.title}`)));
90
+ if (deleted.length && !affected.length &&
91
+ result.warnings.every((warning) => warning.code === 'commitment_deleted_not_recreated')) {
92
+ return {
93
+ status: 'degraded',
94
+ message: `${deleted.length === 1 ? 'A Commitment' : `${deleted.length} Commitments`} from this spec ` +
95
+ `${deleted.length === 1 ? 'was' : 'were'} deleted earlier, so ${deleted.length === 1 ? 'it was' : 'they were'} not created again. ` +
96
+ 'Change its title and apply the spec again if you want it back.',
97
+ };
98
+ }
58
99
  const ids = [...new Set(affected.map((commitment) => commitment.id))]
59
100
  .filter((id) => typeof id === 'string' && /^[A-Za-z0-9_-]+$/.test(id));
60
101
  const safeAgentId = /^[A-Za-z0-9_-]+$/.test(result.agentId) ? result.agentId : null;
102
+ // Always-On was still starting when setup finished, so the only thing that
103
+ // stopped activation was a gate that clears by itself. Say so and name the
104
+ // command that finishes the job; `commitments preflight` is a dry run that
105
+ // never mentions resume (OSK-22351).
106
+ const stillStarting = affected.length > 0 && affected.every((commitment) => commitment.status === 'draft' &&
107
+ (commitment.activationBlockedBy || []).length > 0 &&
108
+ (commitment.activationBlockedBy || []).every((entry) => entry.gate === 'always_on' && entry.reason === 'reconcile_pending'));
109
+ if (stillStarting && ids.length) {
110
+ return {
111
+ status: 'degraded',
112
+ message: `Always-On was still starting when setup finished, so the Commitment${ids.length === 1 ? '' : 's'} ${ids.join(', ')} ` +
113
+ `${ids.length === 1 ? 'was' : 'were'} left as ${ids.length === 1 ? 'a draft' : 'drafts'}. ` +
114
+ 'Nothing else is wrong; resume it in a moment.',
115
+ repairCommand: ids.length === 1
116
+ ? `${bin} commitments resume ${ids[0]}`
117
+ : `${bin} commitments list --agent ${safeAgentId ?? '<agent-id>'} --status draft`,
118
+ };
119
+ }
61
120
  return {
62
121
  status: 'degraded',
63
122
  message: ids.length
@@ -262,7 +321,9 @@ class AgentsSpawn extends base_command_1.BaseCommand {
262
321
  this.log(`(ignored unknown sources: ${plan.droppedWatchers.join(', ')})`);
263
322
  }
264
323
  this.error(plan.failure
265
- ? 'Planning could not start. Review the billing guidance above.'
324
+ ? plan.failure.code === 'balance-exhausted'
325
+ ? 'Planning could not start. Review the billing guidance above.'
326
+ : 'Planning could not complete. Try again later.'
266
327
  : 'Could not build a complete agent yet — refine the sentence and try again.', {
267
328
  exit: 1,
268
329
  });
@@ -270,14 +331,28 @@ class AgentsSpawn extends base_command_1.BaseCommand {
270
331
  const spec = plan.spec;
271
332
  if (!flags.approve) {
272
333
  if (flags.json) {
273
- this.log(JSON.stringify({ ...plan, spec: specWithEffectiveWindowFlags(spec) }, null, 2));
334
+ this.printJsonResult({ ...plan, spec: specWithEffectiveWindowFlags(spec) });
274
335
  return;
275
336
  }
337
+ // The planner's own sentence about the plan (and any note about a value it
338
+ // had to change) was only ever in `--json`.
339
+ if (plan.message) {
340
+ this.log(plan.message);
341
+ this.log('');
342
+ }
276
343
  this.renderSpec(spec);
277
344
  this.log('');
278
345
  this.log('This is a draft — nothing has been created.');
279
- this.log(` Create it: ${this.config.bin} agents spawn "${sentence}" --approve`);
280
- this.log(' Or save & edit the spec, then: --from-spec spec.json --approve');
346
+ const repeat = [
347
+ shellQuote(sentence),
348
+ ...(flags.name ? ['--name', shellQuote(flags.name)] : []),
349
+ ...(flags.timezone ? ['--timezone', shellQuote(flags.timezone)] : []),
350
+ '--approve',
351
+ ].join(' ');
352
+ this.log(` Create it: ${this.config.bin} agents spawn ${repeat}`);
353
+ this.log(' (this plans again, so the Agent may differ a little from this draft)');
354
+ this.log(' Exactly this draft: save the `spec` from the same command with --json as spec.json, then:');
355
+ this.log(' --from-spec spec.json --approve');
281
356
  return;
282
357
  }
283
358
  const result = await proactiveApi_1.proactiveApi.applyProactiveAgentSpec({
@@ -323,7 +398,9 @@ class AgentsSpawn extends base_command_1.BaseCommand {
323
398
  this.log(`Agent: ${id.name} (${id.provider}/${id.model})`);
324
399
  if (id.description)
325
400
  this.log(` ${id.description}`);
326
- this.log(`Systems: ${spec.systems.join(', ')}`);
401
+ // A plan that only creates work (goals, tasks, jobs) has no systems, and a
402
+ // blank line here read as if the plan did nothing (OSK-22349).
403
+ this.log(`Systems: ${spec.systems.length ? spec.systems.join(', ') : 'none (only the work listed below)'}`);
327
404
  if (spec.worker) {
328
405
  this.log('');
329
406
  this.log(`Worker (event-reactive) — policy: ${spec.worker.policy?.mode ?? 'ask_first'}`);
@@ -349,6 +426,29 @@ class AgentsSpawn extends base_command_1.BaseCommand {
349
426
  this.log('Commitments (as provided; subject to validation):');
350
427
  this.log(JSON.stringify(spec.commitments, null, 2));
351
428
  }
429
+ // What approval will create besides the systems above. `--json` always listed
430
+ // these; the text plan showed none of them, so "Create it" created a goal, tasks
431
+ // and a scheduled job the reader had never been shown (OSK-22349, OSK-22358).
432
+ const initialize = spec.initialize;
433
+ if (initialize && (initialize.goals?.length || initialize.tasks?.length || initialize.jobs?.length)) {
434
+ this.log('');
435
+ this.log('It will also create:');
436
+ for (const goal of initialize.goals || [])
437
+ this.log(` goal: ${goal.title}`);
438
+ for (const task of initialize.tasks || []) {
439
+ this.log(` task: ${task.title}${task.priority ? ` (${task.priority})` : ''}`);
440
+ }
441
+ for (const job of initialize.jobs || []) {
442
+ const when = job.cron
443
+ ? `cron ${job.cron}`
444
+ : job.runAtIso ? `once at ${job.runAtIso}` : 'no schedule';
445
+ this.log(` job: ${job.label} — ${when}${job.timezone ? ` ${job.timezone}` : ''}`);
446
+ }
447
+ }
448
+ if (spec.compass?.purpose) {
449
+ this.log('');
450
+ this.log(`Standing direction: ${spec.compass.purpose}`);
451
+ }
352
452
  }
353
453
  renderApplyResult(result, json, existingAgent) {
354
454
  const readiness = proactiveInstallReadiness(result, this.config.bin);
@@ -385,6 +485,24 @@ class AgentsSpawn extends base_command_1.BaseCommand {
385
485
  this.log(` Preflight: ${this.config.bin} triggers preflight <trigger-id>`);
386
486
  }
387
487
  }
488
+ const alwaysOn = result.installed.alwaysOn;
489
+ if (alwaysOn) {
490
+ const state = alwaysOn.desiredEnabled === undefined
491
+ ? alwaysOn.ok ? 'set' : 'failed'
492
+ : alwaysOn.desiredEnabled ? 'on' : 'off';
493
+ this.log(` always-on: ${state}${alwaysOn.operationalState ? ` (${alwaysOn.operationalState})` : ''}`);
494
+ }
495
+ const compass = result.installed.compass;
496
+ if (compass) {
497
+ this.log(` compass: ${compass.skipped ? `kept the existing one (${compass.skipped})` : compass.ok ? 'installed' : 'failed'}`);
498
+ }
499
+ const seeded = initializeSummary(result.installed.initialize);
500
+ if (seeded)
501
+ this.log(` seeded: ${seeded}`);
502
+ for (const commitment of result.installed.commitments || []) {
503
+ this.log(` commitment: ${commitment.title ?? commitment.id} — ${commitment.status ?? 'unknown'}` +
504
+ ` (${commitment.id})${commitment.existing ? ', already existed' : ''}`);
505
+ }
388
506
  for (const watcher of result.installed.defaultWatchers || []) {
389
507
  if (!watcher.ok)
390
508
  continue;
@@ -417,7 +535,9 @@ class AgentsSpawn extends base_command_1.BaseCommand {
417
535
  this.log(`(ignored unknown sources: ${plan.droppedWatchers.join(', ')})`);
418
536
  }
419
537
  this.error(plan.failure
420
- ? 'Recommendation was not created because planning could not start. Review the billing guidance above.'
538
+ ? plan.failure.code === 'balance-exhausted'
539
+ ? 'Recommendation was not created because planning could not start. Review the billing guidance above.'
540
+ : 'Recommendation was not created because planning could not complete. Try again later.'
421
541
  : 'Recommendation was not created — refine the sentence and try again.', {
422
542
  exit: 1,
423
543
  });
@@ -52,6 +52,9 @@ class AgentsTodosCancel extends base_command_1.BaseCommand {
52
52
  return;
53
53
  }
54
54
  this.log(`Cancelled to-do ${args.id} (status: ${todo.status}).`);
55
+ const note = todo.note;
56
+ if (typeof note === 'string' && note)
57
+ this.log(`Note: ${note}`);
55
58
  }
56
59
  }
57
60
  exports.default = AgentsTodosCancel;
@@ -35,7 +35,7 @@ class AgentsTodosEdit extends base_command_1.BaseCommand {
35
35
  this.handleApiError(err);
36
36
  }
37
37
  if (flags.json)
38
- this.log(JSON.stringify(todo, null, 2));
38
+ this.printJsonResult(todo);
39
39
  else
40
40
  this.log(`Updated to-do ${todo.id} — "${todo.name}" at ${todo.runAt}`);
41
41
  }
@@ -122,6 +122,13 @@ class AgentsTriggersPolicy extends base_command_1.BaseCommand {
122
122
  }
123
123
  const policy = (response.policy ?? response) || {};
124
124
  const counts = response.counts ?? {};
125
+ // `configured` is false when nobody chose this policy: the platform default, or a quiet-start
126
+ // row seeded at creation. The numbers below then read like a deliberate choice, and for an
127
+ // Agent with no stored policy they are NOT the seeded ones (24/day, 10/h against 2/day, 1/h)
128
+ // (OSK-22354).
129
+ if (policy.configured === false) {
130
+ this.log('Note: nobody has set this policy: these are the platform defaults (or the quiet start seeded at creation), not a choice.');
131
+ }
125
132
  this.log(`Mode: ${String(policy.mode ?? '-')}`);
126
133
  this.log(`Allowed kinds: ${Array.isArray(policy.allowedKinds) ? policy.allowedKinds.join(', ') : '-'}`);
127
134
  this.log(`Max fires/day: ${String(policy.maxFiresPerDay ?? '-')}`);
@@ -59,8 +59,23 @@ function preflightHeadline(report, persisted) {
59
59
  return `${label}: A capability or configuration check is still needed`;
60
60
  const reasons = report.gates?.find((gate) => gate.id === 'budget_bounds')?.detail?.reasons;
61
61
  const noActionRuns = Array.isArray(reasons) && reasons.includes('action_runs_zero');
62
- return noActionRuns
63
- ? `${label}: Ready to run, but its daily Run budget is 0, so no agent turn will start`
62
+ // `Ready to run` is a statement about activation. Two advisory gates also say whether
63
+ // anything it produces can reach a person, and a headline that ignores them reads as
64
+ // "ready" over a Commitment that can neither deliver nor contact (OSK-22338, OSK-22352).
65
+ // A quiet-hours or interval hold is a chosen, self-clearing quiet and stays out of it.
66
+ const gateById = (id) => report.gates?.find((gate) => gate.id === id);
67
+ const caveats = [];
68
+ if (noActionRuns)
69
+ caveats.push('its daily Run budget is 0, so no agent turn will start');
70
+ if (gateById('endpoint')?.verdict === 'block') {
71
+ caveats.push('no connected endpoint can deliver its reports');
72
+ }
73
+ const attention = gateById('attention');
74
+ if (attention?.verdict === 'block' && attention.reason === 'policy_nudge_muted') {
75
+ caveats.push('its daily nudge limit is 0, so it never contacts you');
76
+ }
77
+ return caveats.length
78
+ ? `${label}: Ready to run, but ${caveats.join(', and ')}`
64
79
  : `${label}: Ready to run`;
65
80
  }
66
81
  function preflightGateLines(gate, verbose = false, refusesActivation = false) {
@@ -54,6 +54,7 @@ class Daemon extends core_1.Command {
54
54
  this.log(' skrr daemon recover-offline-queue — restore recoverable offline WALs');
55
55
  this.log(' skrr daemon usage — show local Claude Code and Codex usage limits');
56
56
  this.log(' skrr daemon byok — manage local BYOK Keychain credentials');
57
+ this.log(' skrr daemon profile — list, select, clean up, remove and restore profiles');
57
58
  this.log('');
58
59
  // These three are registered as aliases of top-level commands, which oclif
59
60
  // does not list under the topic. They are the commands you reach for during