@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
@@ -0,0 +1,78 @@
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 prompt_1 = require("../../../lib/prompt");
6
+ const initiatives_worker_1 = require("../../../lib/initiatives-worker");
7
+ /**
8
+ * `skrr initiatives worker deactivate <agent-id>` — stop the agent's WORKER: every one of its
9
+ * worker watchers (task/goal, follow-through, memory, ...) is disabled and its initiative policy
10
+ * goes to `off`. The agent itself is kept.
11
+ *
12
+ * A worker watcher is owned by the platform, so `agents triggers delete` refuses one with
13
+ * PRODUCER_OWNED_TRIGGER; this is the command that refusal names (OSK-22423).
14
+ */
15
+ class InitiativesWorkerDeactivate extends base_command_1.BaseCommand {
16
+ static description = "Stop an agent's worker: disable all its worker watchers and turn its initiative policy off (the agent is kept)";
17
+ static examples = [
18
+ '<%= config.bin %> initiatives worker deactivate <agent-id>',
19
+ '<%= config.bin %> initiatives worker deactivate <agent-id> --keep-initiatives --yes',
20
+ ];
21
+ static args = {
22
+ agent: core_1.Args.string({ ignoreStdin: true, description: 'Agent ID', required: true }),
23
+ };
24
+ static flags = {
25
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
26
+ yes: core_1.Flags.boolean({ char: 'y', description: 'Skip the confirmation prompt' }),
27
+ 'keep-initiatives': core_1.Flags.boolean({
28
+ description: 'Leave the agent\'s open initiatives as they are (by default they are closed)',
29
+ }),
30
+ reason: core_1.Flags.string({ description: 'Why (recorded on the change)' }),
31
+ };
32
+ async run() {
33
+ this.requireAuth();
34
+ const { args, flags } = await this.parse(InitiativesWorkerDeactivate);
35
+ let confirmed;
36
+ try {
37
+ confirmed = await (0, prompt_1.confirmDestructive)(`Disable every worker watcher of ${args.agent} and turn its initiative policy off` +
38
+ `${flags['keep-initiatives'] ? '' : ', closing its open initiatives'}?`, flags.yes);
39
+ }
40
+ catch (err) {
41
+ if (err.exit === 7)
42
+ this.error(err.message, { exit: 7 });
43
+ throw err;
44
+ }
45
+ if (!confirmed) {
46
+ this.log('Cancelled.');
47
+ return;
48
+ }
49
+ let result;
50
+ try {
51
+ result = await initiatives_worker_1.initiativesWorkerApi.deactivate({
52
+ agentId: args.agent,
53
+ ...(flags.reason ? { reason: flags.reason } : {}),
54
+ ...(flags['keep-initiatives'] ? { closeOpenInitiatives: false } : {}),
55
+ });
56
+ }
57
+ catch (err) {
58
+ this.handleApiError(err);
59
+ }
60
+ if (flags.json) {
61
+ this.printJsonResult(result);
62
+ return;
63
+ }
64
+ this.log(`Worker stopped for ${result.agentId}.`);
65
+ for (const item of result.schedules ?? []) {
66
+ if (item.skipped || !item.schedule)
67
+ continue;
68
+ this.log(` ${item.kind}: ${item.schedule.enabled === false ? 'disabled' : 'unchanged'}` +
69
+ `${item.schedule.triggerId ? ` (${item.schedule.triggerId})` : ''}`);
70
+ }
71
+ const closure = result.initiativeClosure;
72
+ if (closure && !closure.skipped) {
73
+ this.log(` initiatives closed: ${closure.modified ?? 0} of ${closure.matched ?? 0}`);
74
+ }
75
+ this.log('The watchers stay listed, disabled. They are not deleted.');
76
+ }
77
+ }
78
+ exports.default = InitiativesWorkerDeactivate;
@@ -248,7 +248,10 @@ class Login extends base_command_1.BaseCommand {
248
248
  // and a failure here must not fail it or discard what the user just earned.
249
249
  // It degrades to exactly the old behaviour, with a hint naming the command
250
250
  // that finishes the job.
251
- let handoff = await (0, daemonHandoff_1.handOffToLocalDaemon)(process.env, { loginFlow: result.flow });
251
+ let handoff = await (0, daemonHandoff_1.handOffToLocalDaemon)(process.env, {
252
+ loginFlow: result.flow,
253
+ brokerProfile: result.brokerProfile,
254
+ });
252
255
  // Nothing to hand a credential TO. This is the first moment we can fix
253
256
  // that correctly — installing the daemon binds it to a deployment and a
254
257
  // profile, and until this login there was no session to take them from.
@@ -264,7 +267,10 @@ class Login extends base_command_1.BaseCommand {
264
267
  if (setup.status === 'installed') {
265
268
  // Re-run rather than duplicating the mint here: it is the same act
266
269
  // it always was, and now it has somewhere to land.
267
- handoff = await (0, daemonHandoff_1.handOffToLocalDaemon)(process.env, { loginFlow: result.flow });
270
+ handoff = await (0, daemonHandoff_1.handOffToLocalDaemon)(process.env, {
271
+ loginFlow: result.flow,
272
+ brokerProfile: result.brokerProfile,
273
+ });
268
274
  }
269
275
  else if (setup.status === 'failed') {
270
276
  this.log(`Could not set up the background service: ${setup.detail}.`);
@@ -1,15 +1,35 @@
1
1
  import { BaseCommand } from '../base-command';
2
+ import { type CliSessionRevokeResult } from '../lib/refresh';
2
3
  export declare function shouldSkipLocalLogout(input: {
3
4
  hasAnyStoredToken: boolean;
4
5
  hasUsableLocalToken: boolean;
5
6
  hasUnreadableEncryptedToken: boolean;
6
7
  allDevices: boolean;
7
8
  }): boolean;
9
+ /**
10
+ * Why the sign-in this logout removed is still a live session on the server,
11
+ * or null when the server took the revoke, or there was no session to revoke.
12
+ *
13
+ * Logout clears the local credential whatever the server says, so a person can
14
+ * always sign out of a computer. It used to say "Signed out." either way, and a
15
+ * session the server never heard about stayed usable with nothing to show for
16
+ * it (OSK-22307: a profile whose files `skrrd profile remove` had moved could
17
+ * not decrypt its CLI credential, so nothing was sent).
18
+ */
19
+ export declare function unrevokedSessionReason(input: {
20
+ revoke: CliSessionRevokeResult;
21
+ hasUnreadableEncryptedToken: boolean;
22
+ hasAnyStoredToken: boolean;
23
+ serverUrl: string;
24
+ }): string | null;
25
+ /** How to end a session this computer could not revoke, from a profile still signed in. */
26
+ export declare function unrevokedSessionRemedy(cliId: string | undefined): string;
8
27
  export default class Logout extends BaseCommand {
9
28
  static description: string;
10
29
  static flags: {
11
30
  'all-devices': import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
31
  yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
32
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
33
  };
14
34
  run(): Promise<void>;
15
35
  /**
@@ -34,6 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.shouldSkipLocalLogout = shouldSkipLocalLogout;
37
+ exports.unrevokedSessionReason = unrevokedSessionReason;
38
+ exports.unrevokedSessionRemedy = unrevokedSessionRemedy;
37
39
  const core_1 = require("@oclif/core");
38
40
  const base_command_1 = require("../base-command");
39
41
  const config_1 = require("../lib/config");
@@ -42,6 +44,7 @@ const auth_storage_1 = require("../lib/auth-storage");
42
44
  const daemonBroker_1 = require("../lib/daemonBroker");
43
45
  const dedicated_service_1 = require("../lib/dedicated-service");
44
46
  const refresh_1 = require("../lib/refresh");
47
+ const cli_id_1 = require("../lib/cli-id");
45
48
  const api_fetch_1 = require("../lib/api-fetch");
46
49
  const cred_envelope_1 = require("../lib/cred-envelope");
47
50
  const device_identity_1 = require("../lib/device-identity");
@@ -52,6 +55,54 @@ function shouldSkipLocalLogout(input) {
52
55
  !input.hasUnreadableEncryptedToken &&
53
56
  !input.allDevices);
54
57
  }
58
+ function hostOf(serverUrl) {
59
+ try {
60
+ return new URL(serverUrl).host || serverUrl;
61
+ }
62
+ catch {
63
+ return serverUrl;
64
+ }
65
+ }
66
+ /**
67
+ * Why the sign-in this logout removed is still a live session on the server,
68
+ * or null when the server took the revoke, or there was no session to revoke.
69
+ *
70
+ * Logout clears the local credential whatever the server says, so a person can
71
+ * always sign out of a computer. It used to say "Signed out." either way, and a
72
+ * session the server never heard about stayed usable with nothing to show for
73
+ * it (OSK-22307: a profile whose files `skrrd profile remove` had moved could
74
+ * not decrypt its CLI credential, so nothing was sent).
75
+ */
76
+ function unrevokedSessionReason(input) {
77
+ const { revoke } = input;
78
+ const host = hostOf(input.serverUrl);
79
+ switch (revoke.outcome) {
80
+ case 'accepted':
81
+ return null;
82
+ case 'refused':
83
+ return `${host} answered HTTP ${revoke.status}`;
84
+ case 'unreachable':
85
+ return `${host} could not be reached (${revoke.detail})`;
86
+ case 'not_sent':
87
+ if (input.hasUnreadableEncryptedToken) {
88
+ return 'the stored sign-in could not be decrypted on this computer, so there was nothing to present to the server';
89
+ }
90
+ if (revoke.reason === 'read_failed') {
91
+ return `the stored sign-in could not be read (${revoke.detail ?? 'unknown error'})`;
92
+ }
93
+ if (revoke.reason === 'no_credential' && input.hasAnyStoredToken) {
94
+ return `the stored sign-in is not bound to ${host}, so it was not sent there`;
95
+ }
96
+ // Nothing stored, or a token with no session behind it to end here.
97
+ return null;
98
+ }
99
+ }
100
+ /** How to end a session this computer could not revoke, from a profile still signed in. */
101
+ function unrevokedSessionRemedy(cliId) {
102
+ const which = cliId ? `the row whose DAEMON is ${cliId}` : "this computer's CLI session";
103
+ return ('It stays usable until it expires. To end it now, run `skrr token list --kind cli` ' +
104
+ `from a profile that is still signed in, find ${which}, and run \`skrr token revoke <id>\`.`);
105
+ }
55
106
  /**
56
107
  * `skrr logout` / `skrr logout --all-devices`
57
108
  *
@@ -125,6 +176,12 @@ class Logout extends base_command_1.BaseCommand {
125
176
  description: 'Skip the --all-devices confirmation prompt (CI / scripting).',
126
177
  default: false,
127
178
  }),
179
+ json: core_1.Flags.boolean({
180
+ description: 'Print the outcome as JSON: whether a local sign-in was removed and whether its ' +
181
+ 'server session was revoked. `ok` is false when a session was left live.',
182
+ default: false,
183
+ exclusive: ['all-devices'],
184
+ }),
128
185
  };
129
186
  async run() {
130
187
  const { flags } = await this.parse(Logout);
@@ -147,6 +204,14 @@ class Logout extends base_command_1.BaseCommand {
147
204
  // `access_token`) there IS no local credential to clear — the CLI holds
148
205
  // a per-process token redeemed over loopback and nothing is persisted.
149
206
  // Say that honestly rather than reporting a logout that did not happen.
207
+ if (flags.json) {
208
+ this.printJsonResult({
209
+ signedOut: false,
210
+ profile: keychain.getActiveProfile(),
211
+ serverSession: 'none',
212
+ });
213
+ return;
214
+ }
150
215
  if (platformManagedHandoff()) {
151
216
  this.log("This machine is signed in through the platform's managed hand-off; " +
152
217
  'there is no local credential to clear.');
@@ -186,13 +251,29 @@ class Logout extends base_command_1.BaseCommand {
186
251
  // every daemon-scope refresh session, but the CLI's OWN refresh
187
252
  // session is a `scope='cli'` row without a Daemon FK and was NOT
188
253
  // touched by the iteration. This call gets it.
254
+ //
255
+ // Its outcome is reported, never a reason to stop: logout must succeed
256
+ // locally even when the API host is unreachable.
257
+ let revoke;
189
258
  try {
190
- await (0, refresh_1.revokeCurrentRefreshToken)();
259
+ revoke = await (0, refresh_1.revokeCurrentRefreshToken)();
191
260
  }
192
- catch {
193
- // intentionally swallowed — logout must succeed locally even
194
- // when the API host is unreachable.
261
+ catch (err) {
262
+ revoke = {
263
+ outcome: 'not_sent',
264
+ reason: 'read_failed',
265
+ detail: err instanceof Error ? err.message : String(err),
266
+ };
195
267
  }
268
+ // Read before the config is rewritten below, which keeps it anyway.
269
+ const configBefore = (0, config_1.loadConfig)();
270
+ const unrevoked = unrevokedSessionReason({
271
+ revoke,
272
+ hasUnreadableEncryptedToken,
273
+ hasAnyStoredToken,
274
+ serverUrl: configBefore.baseURL,
275
+ });
276
+ const cliId = (0, cli_id_1.resolveCliId)(configBefore);
196
277
  (0, auth_storage_1.clearAllBackends)();
197
278
  // Sweep the credentials this product wrote under its PREVIOUS brand.
198
279
  //
@@ -265,12 +346,36 @@ class Logout extends base_command_1.BaseCommand {
265
346
  // below); `skrr login` clears the flag.
266
347
  adoptDaemonSession: false,
267
348
  });
349
+ if (flags.json) {
350
+ this.printJsonResult({
351
+ signedOut: true,
352
+ profile: keychain.getActiveProfile(),
353
+ server: configBefore.baseURL,
354
+ cliId: cliId ?? null,
355
+ serverSession: unrevoked
356
+ ? 'not_revoked'
357
+ : revoke.outcome === 'accepted'
358
+ ? 'revoked'
359
+ : 'none',
360
+ ...(unrevoked ? { reason: unrevoked } : {}),
361
+ ...(sweptLegacy.length > 0 ? { removedLegacyCredentials: sweptLegacy } : {}),
362
+ }, { ok: !unrevoked });
363
+ return;
364
+ }
268
365
  const finalMessage = flags['all-devices']
269
366
  ? allDevicesError
270
367
  ? 'Signed out locally. Remote daemons NOT revoked (see warning above).'
271
368
  : 'Signed out from all devices.'
272
- : 'Signed out.';
369
+ : unrevoked
370
+ ? `Signed out on this computer, but its session was NOT revoked: ${unrevoked}.`
371
+ : 'Signed out.';
273
372
  this.log(finalMessage);
373
+ if (unrevoked) {
374
+ if (flags['all-devices']) {
375
+ this.log(`This computer's own CLI session was NOT revoked: ${unrevoked}.`);
376
+ }
377
+ this.log(unrevokedSessionRemedy(cliId));
378
+ }
274
379
  // On a brokered Dedicated guest the sign-in just removed was the person's
275
380
  // OWN (an explicit `skrr login`); the machine's platform-managed access is
276
381
  // untouched and skrr keeps working through it. Say both, so "Signed out."
@@ -39,9 +39,12 @@ class MemoryMaintain extends base_command_1.BaseCommand {
39
39
  }
40
40
  let result;
41
41
  // Keep stdout machine-readable for --json; progress goes only to stderr.
42
+ // A plain remember takes about 4 to 5 seconds, so the notice waits past that: shown on
43
+ // every ordinary save it carried no information (OSK-22394). Only a save that is
44
+ // actually slow gets it.
42
45
  const waiting = args.operation === 'remember' ? setTimeout(() => {
43
46
  process.stderr.write('Still waiting for the memory save; the result is not confirmed yet.\n');
44
- }, 4000) : null;
47
+ }, 10_000) : null;
45
48
  waiting?.unref();
46
49
  try {
47
50
  if (args.operation === 'remember')
@@ -55,7 +58,18 @@ class MemoryMaintain extends base_command_1.BaseCommand {
55
58
  const transportLost = ['ECONNABORTED', 'ETIMEDOUT', 'ECONNRESET', 'EPIPE', 'ERR_NETWORK', 'ECONNREFUSED', 'EAI_AGAIN'].includes(e?.code || '') ||
56
59
  e?.name === 'TimeoutError' || /fetch failed|socket hang up|network error|timed out|timeout/i.test(e?.message || '');
57
60
  if (args.operation === 'remember' && ((status !== undefined && status >= 500) || (!status && transportLost))) {
58
- this.error('The memory save was not confirmed. It may have succeeded; check the Agent’s Memory or retry the exact same command.', { code: 'MEMORY_OUTCOME_UNKNOWN' });
61
+ // The save may have landed, and an identical retry is an idempotent replay (the
62
+ // server answers `idempotentReplay`), so the error is retryable and names the
63
+ // exact read that settles it, as `memory topics create` does (OSK-22393).
64
+ const check = `${this.config.bin} memory topics list --agent ${flags.agent} --scope agent:${flags.agent}`;
65
+ this.failWithCliError({
66
+ message: `The memory save was not confirmed. It may have succeeded. Check with \`${check}\`, ` +
67
+ 'or run the exact same command again: an identical retry is safe and is answered as an idempotent replay if the first save landed.',
68
+ code: 'MEMORY_OUTCOME_UNKNOWN',
69
+ exit: 1,
70
+ retryable: true,
71
+ details: { outcome: 'unknown', operation: 'remember', agentId: flags.agent, check },
72
+ });
59
73
  }
60
74
  this.handleApiError(error);
61
75
  }
@@ -22,7 +22,7 @@ class SpacesDelete extends base_command_1.BaseCommand {
22
22
  const spaceRef = await this.resolveEntityRef('space', args.id);
23
23
  let confirmed;
24
24
  try {
25
- confirmed = await (0, prompt_1.confirmDestructive)(`Delete space ${spaceRef}? This cannot be undone.`, flags.yes);
25
+ confirmed = await (0, prompt_1.confirmDestructive)(`Delete space ${spaceRef}? This cannot be undone. Tasks in the space are not deleted: they stay as your own tasks outside any space.`, flags.yes);
26
26
  }
27
27
  catch (err) {
28
28
  if (err.exit === 7) {
@@ -41,6 +41,11 @@ class SpacesDelete extends base_command_1.BaseCommand {
41
41
  this.handleApiError(err);
42
42
  }
43
43
  this.log(`Deleted space ${spaceRef}`);
44
+ // The server unlinks a deleted Space's tasks rather than deleting them: they are the owner's
45
+ // own work. Until now the receipt said nothing, and they surfaced later in task lists with no
46
+ // Space (OSK-22519).
47
+ this.log('Its tasks were not deleted. They stay as your own tasks outside any space; find them with ' +
48
+ `\`${this.config.bin} tasks list\` and delete or move any you do not want.`);
44
49
  }
45
50
  }
46
51
  exports.default = SpacesDelete;
@@ -34,8 +34,13 @@ class SpacesWorkflowsArchive extends base_command_1.BaseCommand {
34
34
  const result = await data_provider_1.dataService.archiveSpaceWorkflow(args.spaceId, args.workflowId);
35
35
  if (flags.json)
36
36
  this.log(JSON.stringify(result, null, 2));
37
- else
37
+ else {
38
38
  this.log(`Archived workflow ${result.id}.`);
39
+ const paused = result.pausedTriggers ?? 0;
40
+ // Its triggers are hidden once it is archived, so say what became of the active ones.
41
+ if (paused > 0)
42
+ this.log(`Paused ${paused} active trigger${paused === 1 ? '' : 's'} (schedule timers retired); none will fire.`);
43
+ }
39
44
  }
40
45
  catch (error) {
41
46
  this.handleApiError(error);
@@ -35,7 +35,9 @@ class SpacesWorkflowsPublish extends base_command_1.BaseCommand {
35
35
  // Published, not refused (owner decision 2026-10-15) — so the warning has to be loud here.
36
36
  const warnings = version.warnings ?? [];
37
37
  if (warnings.length) {
38
- this.warn(`Published with ${warnings.length} warning${warnings.length === 1 ? '' : 's'} — runs of this version will hit ${warnings.length === 1 ? 'it' : 'them'}:`);
38
+ // Not every warning is something a run hits (an unrouted outcome, an unconnected branch are
39
+ // facts about the graph), so the line says only that the publish carried them.
40
+ this.warn(`Published with ${warnings.length} warning${warnings.length === 1 ? '' : 's'} — the version is live; check ${warnings.length === 1 ? 'it' : 'them'}:`);
39
41
  for (const line of (0, workflow_issues_1.formatWorkflowIssues)(warnings))
40
42
  this.log(line);
41
43
  }
@@ -15,6 +15,7 @@ export declare function describeNodeAttention(node: {
15
15
  error?: {
16
16
  message?: string;
17
17
  } | null;
18
+ blockedReason?: string | null;
18
19
  }): string;
19
20
  export declare function describeLoopItemsNote(node: {
20
21
  nodeKey?: unknown;
@@ -23,7 +23,12 @@ function describeNodeAttention(node) {
23
23
  if (node.lane !== 'attention')
24
24
  return '';
25
25
  const reason = typeof node.attentionReason === 'string' ? node.attentionReason : '';
26
- const message = typeof node.error?.message === 'string' ? node.error.message : '';
26
+ // A blocked node's reason is its Task's blocker, which is not an `error` (OSK-21738).
27
+ const message = typeof node.error?.message === 'string'
28
+ ? node.error.message
29
+ : reason === 'blocked' && typeof node.blockedReason === 'string'
30
+ ? node.blockedReason
31
+ : '';
27
32
  if (reason && message)
28
33
  return `${reason}: ${message}`;
29
34
  return reason || message || 'needs attention';
@@ -95,6 +100,17 @@ class SpacesWorkflowsRun extends base_command_1.BaseCommand {
95
100
  }), null, 2));
96
101
  this.log(`Run: ${run.id}`);
97
102
  this.log(`Status: ${run.status}`);
103
+ // Why a failed run failed, when it was an outcome with nowhere to go (OSK-21658).
104
+ const failureCause = run.failureCause;
105
+ if (typeof failureCause?.message === 'string')
106
+ this.log(`Why: ${oneLine(failureCause.message)}`);
107
+ // A run is `paused` only when no other branch can make progress. With a paused step and a
108
+ // successor still pending it stays `running`, which read as though the pause had not taken
109
+ // (OSK-22459), so say how many steps are paused and why the run is not.
110
+ const pausedSteps = (run.nodes || []).filter((node) => node.status === 'paused').length;
111
+ if (pausedSteps > 0 && run.status !== 'paused') {
112
+ this.log(`Paused steps: ${pausedSteps} (the run is not \`paused\` while other work could still be dispatched).`);
113
+ }
98
114
  for (const line of (0, workflow_run_budget_1.describeRunBudget)(run))
99
115
  this.log(line);
100
116
  if (runUrl)
@@ -33,7 +33,9 @@ class SpacesWorkflowsTriggersCreate extends base_command_1.BaseCommand {
33
33
  default: 'paused',
34
34
  description: 'Initial trigger status',
35
35
  }),
36
- config: core_1.Flags.string({ description: 'Trigger config as JSON' }),
36
+ config: core_1.Flags.string({
37
+ description: 'Trigger config as JSON. schedule: {"intervalMs":60000} (milliseconds, 60000 to 2678400000) plus an optional "input" object; webhook takes none.',
38
+ }),
37
39
  'config-file': core_1.Flags.string({ description: 'Path to JSON trigger config, or "-" for stdin' }),
38
40
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
39
41
  };
@@ -98,7 +98,9 @@ class TasksWorkflowContext extends base_command_1.BaseCommand {
98
98
  }
99
99
  }
100
100
  if (downstream.length) {
101
- this.log('Waiting on this:');
101
+ // Only steps that can still run are waiting; a finished run's downstream steps are listed
102
+ // under a neutral heading instead of claiming they wait on a completed step (OSK-22284).
103
+ this.log(context.hasLiveDownstream ? 'Waiting on this:' : 'Downstream:');
102
104
  for (const entry of downstream) {
103
105
  // A pruned edge means "decided against", not "not yet" — the two lead
104
106
  // to opposite decisions about whether to keep working on this step.
@@ -32,7 +32,23 @@ class TriggersCapabilities extends base_command_1.BaseCommand {
32
32
  }
33
33
  this.log(`Scope: ${String(capabilities.scopeKind ?? args.scope)}`);
34
34
  this.log(`Kinds: ${Array.isArray(capabilities.allowedKinds) ? capabilities.allowedKinds.join(', ') : '-'}`);
35
- this.log(`Modes: ${Array.isArray(capabilities.allowedExecutorModes) ? capabilities.allowedExecutorModes.join(', ') : '-'}`);
35
+ // The modes `triggers create --mode` will accept. `allowedExecutorModes` is longer: it keeps the
36
+ // modes only an internal producer may mint, which create refuses, so listing it here offered
37
+ // choices that fail on submit (OSK-22489). A server that predates the field only has the long
38
+ // list, and a person on it may be offered one refused choice.
39
+ const authorable = Array.isArray(capabilities.authorableExecutorModes)
40
+ ? capabilities.authorableExecutorModes
41
+ : capabilities.allowedExecutorModes;
42
+ this.log(`Modes: ${Array.isArray(authorable) ? authorable.join(', ') : '-'}`);
43
+ // The mode names say nothing about side effects; describe the ones an author usually picks
44
+ // between (OSK-21766).
45
+ if (Array.isArray(authorable)) {
46
+ for (const mode of authorable) {
47
+ const effect = (0, triggers_1.executorModeEffect)(mode);
48
+ if (effect)
49
+ this.log(` ${String(mode)}: ${effect}`);
50
+ }
51
+ }
36
52
  const vars = Array.isArray(capabilities.templateVariables)
37
53
  ? capabilities.templateVariables.map((v) => typeof v === 'object' && v !== null ? String(v.name) : String(v))
38
54
  : capabilities.templateVariableNames;
@@ -78,6 +78,8 @@ export default class TriggersCreate extends BaseCommand {
78
78
  'allow-unknown-event': import("@oclif/core/interfaces").BooleanFlag<boolean>;
79
79
  };
80
80
  run(): Promise<void>;
81
+ /** How a saved working / quiet window will be read, when that is not what it looks like (OSK-22530). */
82
+ private warnWindowAdvice;
81
83
  private warnMissingSelfSchedule;
82
84
  /**
83
85
  * The server creates the trigger and then says whether something already
@@ -40,7 +40,10 @@ class TriggersCreate extends base_command_1.BaseCommand {
40
40
  description: 'Create enabled or disabled (default: enabled; pass --no-enabled to author it inert)',
41
41
  allowNo: true,
42
42
  }),
43
- mode: core_1.Flags.string({ description: 'Execution mode', options: [...triggers_1.TRIGGER_EXECUTOR_MODES] }),
43
+ mode: core_1.Flags.string({
44
+ description: triggers_1.TRIGGER_MODE_FLAG_DESCRIPTION,
45
+ options: [...triggers_1.TRIGGER_EXECUTOR_MODES],
46
+ }),
44
47
  prompt: core_1.Flags.string({ description: 'Prompt template sent when the trigger fires' }),
45
48
  'builtin-action': core_1.Flags.string({
46
49
  description: 'Typed builtinAction JSON object for mode=builtin_action',
@@ -81,8 +84,12 @@ class TriggersCreate extends base_command_1.BaseCommand {
81
84
  multiple: true,
82
85
  }),
83
86
  references: core_1.Flags.string({ description: 'Execution references JSON array' }),
84
- 'working-hours': core_1.Flags.string({ description: 'Execution workingHours JSON object' }),
85
- 'quiet-hours': core_1.Flags.string({ description: 'Execution quietHours JSON object' }),
87
+ 'working-hours': core_1.Flags.string({
88
+ description: `Execution workingHours: only fires inside the window run. ${triggers_1.TRIGGER_WINDOW_FLAG_HELP}`,
89
+ }),
90
+ 'quiet-hours': core_1.Flags.string({
91
+ description: `Execution quietHours: fires inside the window are skipped. ${triggers_1.TRIGGER_WINDOW_FLAG_HELP}`,
92
+ }),
86
93
  cron: core_1.Flags.string({ description: 'Cron expression for schedule triggers' }),
87
94
  'interval-ms': core_1.Flags.integer({ description: 'Interval schedule period in milliseconds' }),
88
95
  'interval-minutes': core_1.Flags.integer({ description: 'Interval schedule period in minutes' }),
@@ -90,7 +97,9 @@ class TriggersCreate extends base_command_1.BaseCommand {
90
97
  description: 'Daily HH:MM fire time for schedule triggers (repeatable or comma-separated)',
91
98
  multiple: true,
92
99
  }),
93
- timezone: core_1.Flags.string({ description: 'IANA timezone for schedule triggers' }),
100
+ timezone: core_1.Flags.string({
101
+ description: 'IANA timezone for schedule triggers, for example America/Los_Angeles. Defaults to UTC: without it --daily-time 09:30 or a cron runs at 09:30 UTC, not at 09:30 where you are.',
102
+ }),
94
103
  'max-fires-per-day': core_1.Flags.integer({
95
104
  description: 'Daily fire cap (schedule, stochastic and self_scheduled triggers only)',
96
105
  }),
@@ -325,6 +334,7 @@ class TriggersCreate extends base_command_1.BaseCommand {
325
334
  if (trigger.dryRun) {
326
335
  this.log('Trigger accepted by dry run.');
327
336
  this.warnMissingSelfSchedule(trigger);
337
+ this.warnWindowAdvice(trigger);
328
338
  return;
329
339
  }
330
340
  this.log('Created trigger:');
@@ -333,6 +343,12 @@ class TriggersCreate extends base_command_1.BaseCommand {
333
343
  this.log(`View it at ${url}`);
334
344
  this.warnDuplicateSubscriptions(trigger);
335
345
  this.warnMissingSelfSchedule(trigger);
346
+ this.warnWindowAdvice(trigger);
347
+ }
348
+ /** How a saved working / quiet window will be read, when that is not what it looks like (OSK-22530). */
349
+ warnWindowAdvice(trigger) {
350
+ for (const advice of (0, triggers_1.windowAuthoringAdvice)(trigger))
351
+ this.warn(advice);
336
352
  }
337
353
  warnMissingSelfSchedule(trigger) {
338
354
  const warnings = trigger?.warnings;
@@ -381,9 +397,9 @@ class TriggersCreate extends base_command_1.BaseCommand {
381
397
  if (execution.mode === 'builtin_action') {
382
398
  const builtinAction = execution.builtinAction;
383
399
  if (!builtinAction || typeof builtinAction.builtinType !== 'string') {
384
- this.error('mode=builtin_action requires --builtin-type (and --builtin-config).', {
385
- exit: 1,
386
- });
400
+ this.error('mode=builtin_action runs a deterministic action with no model turn, so it needs an action and no prompt: ' +
401
+ 'pass --builtin-type and --builtin-config, or execution.builtinAction { builtinType, config } in --from-json. ' +
402
+ `\`${this.config.bin} triggers actions\` lists the types and their config.`, { exit: 1 });
387
403
  }
388
404
  const { ok, missing } = (0, builtinActions_1.validateBuiltinConfig)(builtinAction.builtinType, builtinAction.config);
389
405
  if (!ok) {
@@ -25,14 +25,23 @@ function describeFireAuditDetail(detail, fireId, triggerId) {
25
25
  lines.push(`Reason: ${reason}`);
26
26
  if (message && message !== reason)
27
27
  lines.push(`${reason ? 'Detail:' : 'Reason:'} ${message}`);
28
- const quietHours = (0, triggers_1.quietHoursAuditExplanation)(detail);
29
- if (quietHours) {
30
- lines.push(`Explanation: ${quietHours.summary}. ${quietHours.detail}`);
28
+ const clockSkip = (0, triggers_1.clockSkipAuditExplanation)(detail);
29
+ if (clockSkip) {
30
+ lines.push(`Explanation: ${clockSkip.summary}. ${clockSkip.detail}`);
31
31
  }
32
32
  const policy = (0, triggers_1.policyAuditExplanation)(detail);
33
33
  if (policy) {
34
34
  lines.push(`Explanation: ${policy.summary}. ${policy.detail}`);
35
35
  }
36
+ const coalesced = (0, triggers_1.coalescedAuditExplanation)(detail);
37
+ if (coalesced) {
38
+ lines.push(`Explanation: ${coalesced.summary}. ${coalesced.detail}`);
39
+ }
40
+ // Any fire whose receipt was offered as a card says what came of it, whatever skipped it (ask-first,
41
+ // quiet hours, a cap), not only the suggestions-only case explained above.
42
+ const policyCard = (0, triggers_1.policyCardSentence)(detail.metadata?.policyCard);
43
+ if (policyCard && !policy)
44
+ lines.push(`Inbox card: ${policyCard}`);
36
45
  if (detail.durationMs !== undefined)
37
46
  lines.push(`Duration: ${String(detail.durationMs)}ms`);
38
47
  if (detail.conversationId)
@@ -7,6 +7,7 @@ export default class TriggersList extends BaseCommand {
7
7
  scope: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  kind: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
9
  enabled: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ ref: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
11
  'ref-entity': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
12
  limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
12
13
  before: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -9,6 +9,7 @@ class TriggersList extends base_command_1.BaseCommand {
9
9
  static examples = [
10
10
  '<%= config.bin %> triggers list',
11
11
  '<%= config.bin %> triggers list --scope agent --kind schedule --enabled',
12
+ '<%= config.bin %> triggers list --ref agentId=<agent-id> --json',
12
13
  '<%= config.bin %> triggers list --ref-entity agent:<agent-id> --json',
13
14
  ];
14
15
  static flags = {
@@ -16,6 +17,10 @@ class TriggersList extends base_command_1.BaseCommand {
16
17
  scope: core_1.Flags.string({ description: 'Filter by scope kind', options: [...triggers_1.TRIGGER_SCOPE_KINDS] }),
17
18
  kind: core_1.Flags.string({ description: 'Filter by trigger kind', options: [...triggers_1.TRIGGER_KINDS] }),
18
19
  enabled: core_1.Flags.boolean({ description: 'Filter by enabled state', allowNo: true }),
20
+ ref: core_1.Flags.string({
21
+ description: 'Filter by a scope ref as key=value (repeatable), the same spelling `triggers create` takes, for example --ref agentId=abc',
22
+ multiple: true,
23
+ }),
19
24
  'ref-entity': core_1.Flags.string({
20
25
  description: 'Filter by ref entity as kind:id (repeatable), e.g. --ref-entity agent:abc',
21
26
  multiple: true,
@@ -26,11 +31,18 @@ class TriggersList extends base_command_1.BaseCommand {
26
31
  async run() {
27
32
  this.requireAuth();
28
33
  const { flags } = await this.parse(TriggersList);
34
+ let refEntity;
35
+ try {
36
+ refEntity = [...(flags['ref-entity'] ?? []), ...(0, triggers_1.refEntitiesFromRefFlags)(flags.ref)];
37
+ }
38
+ catch (err) {
39
+ this.error(err.message, { exit: 2 });
40
+ }
29
41
  const path = (0, triggers_1.withQuery)('/api/triggers', {
30
42
  scope: flags.scope,
31
43
  kind: flags.kind,
32
44
  enabled: flags.enabled,
33
- refEntity: flags['ref-entity'],
45
+ refEntity: refEntity.length > 0 ? refEntity : undefined,
34
46
  limit: flags.limit,
35
47
  before: flags.before,
36
48
  });