@skrr-ai/cli 0.1.144 → 0.1.146

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 (42) hide show
  1. package/README.md +5 -0
  2. package/dist/commands/agenda/plan.d.ts +21 -0
  3. package/dist/commands/agenda/plan.js +46 -0
  4. package/dist/commands/agent/message/approve.js +7 -5
  5. package/dist/commands/agent/message/decline.js +7 -5
  6. package/dist/commands/agent/message/pending.js +1 -1
  7. package/dist/commands/agents/always-on/enable.js +1 -1
  8. package/dist/commands/agents/plan-day.d.ts +11 -0
  9. package/dist/commands/agents/plan-day.js +41 -2
  10. package/dist/commands/agents/schedule-overview.js +15 -10
  11. package/dist/commands/agents/schedule-trace.js +12 -2
  12. package/dist/commands/agents/spawn.d.ts +73 -1
  13. package/dist/commands/agents/spawn.js +274 -5
  14. package/dist/commands/agents/triggers/fire.js +20 -0
  15. package/dist/commands/agents/upcoming.d.ts +1 -0
  16. package/dist/commands/agents/upcoming.js +18 -7
  17. package/dist/commands/commitments/create.js +1 -1
  18. package/dist/commands/commitments/update.js +1 -1
  19. package/dist/commands/spaces/workflow-templates/insert.js +4 -0
  20. package/dist/commands/store/show.js +22 -0
  21. package/dist/commands/triggers/audit.js +1 -1
  22. package/dist/commands/triggers/fire.js +19 -0
  23. package/dist/generated/agent-guides.json +19 -19
  24. package/dist/lib/agentic-stream.d.ts +28 -0
  25. package/dist/lib/agentic-stream.js +89 -1
  26. package/dist/lib/commitments.js +13 -1
  27. package/dist/lib/compasses.js +1 -1
  28. package/dist/lib/dedicated-power.js +10 -3
  29. package/dist/lib/format.d.ts +20 -0
  30. package/dist/lib/format.js +47 -0
  31. package/dist/lib/planOutcome.d.ts +51 -0
  32. package/dist/lib/planOutcome.js +88 -0
  33. package/dist/lib/proactiveApi.d.ts +100 -1
  34. package/dist/lib/proactiveApi.js +27 -2
  35. package/dist/lib/schedule.d.ts +40 -1
  36. package/dist/lib/schedule.js +51 -2
  37. package/dist/lib/triggers.d.ts +134 -3
  38. package/dist/lib/triggers.js +260 -21
  39. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  40. package/dist/node_modules/@skrr-ai/data-provider/index.js +4677 -4673
  41. package/oclif.manifest.json +40 -4
  42. package/package.json +1 -1
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SPEC_FORMAT_HELP = exports.SPEC_TEMPLATE = void 0;
3
+ exports.DECLINE_UNSUPPORTED_MESSAGE = exports.SPAWN_FOLLOW_MAX_WAIT_MS = exports.SPAWN_FOLLOW_POLL_MS = exports.SPEC_FORMAT_HELP = exports.SPEC_TEMPLATE = void 0;
4
4
  exports.workerPolicyWindowLines = workerPolicyWindowLines;
5
5
  exports.specWithEffectiveWindowFlags = specWithEffectiveWindowFlags;
6
+ exports.installPlanLines = installPlanLines;
7
+ exports.followSpawnOperation = followSpawnOperation;
6
8
  exports.shellQuote = shellQuote;
7
9
  exports.initializeSummary = initializeSummary;
8
10
  exports.proactiveInstallReadiness = proactiveInstallReadiness;
@@ -10,6 +12,7 @@ const core_1 = require("@oclif/core");
10
12
  const base_command_1 = require("../../base-command");
11
13
  const prompt_1 = require("../../lib/prompt");
12
14
  const format_1 = require("../../lib/format");
15
+ const http_error_1 = require("../../lib/http-error");
13
16
  const web_url_1 = require("../../lib/web-url");
14
17
  const proactiveApi_1 = require("../../lib/proactiveApi");
15
18
  function workerPolicyWindowLines(policy) {
@@ -84,6 +87,80 @@ exports.SPEC_FORMAT_HELP = [
84
87
  '- orchestrator (installed when systems has orchestrator): mode review or auto, executePlan true or false, workingHours { start, end, timezone }.',
85
88
  '- Optional: commitments (at most 3), initialize { goals, tasks, jobs }, compass, autonomyPosture.',
86
89
  ].join('\n');
90
+ /**
91
+ * The install plan as lines: every object a spec will install, marked `requested` (the spec names
92
+ * it) or `default` (the platform adds it, and why). A spec for one watcher installed ten systems and
93
+ * the plan and the receipt named one (OSK-22417). A default the target runtime cannot run is marked
94
+ * `will be blocked` with the reason, and a declined one `declined`, so what is NOT installed is as
95
+ * visible as what is.
96
+ */
97
+ function installPlanLines(items, bin) {
98
+ if (!items.length)
99
+ return [];
100
+ const lines = ['Will be installed:'];
101
+ for (const item of items) {
102
+ const mark = item.status === 'declined'
103
+ ? 'declined'
104
+ : item.status === 'will_be_blocked'
105
+ ? 'will be blocked'
106
+ : item.origin;
107
+ const note = item.status === 'declined'
108
+ ? item.reason ?? 'declined'
109
+ : item.status === 'will_be_blocked'
110
+ ? `${item.reason ?? 'blocked'}: ${item.detail ?? 'the runtime cannot run it'}`
111
+ : item.origin === 'default'
112
+ ? item.why
113
+ : '';
114
+ lines.push(` ${mark.padEnd(15)} ${item.label}${note ? ` - ${note}` : ''}`);
115
+ }
116
+ if (items.some((item) => item.origin === 'default' && item.status !== 'declined')) {
117
+ lines.push(`Decline defaults with \`${bin} agents spawn ... --without <name>\` (${proactiveApi_1.DECLINABLE_DEFAULTS.join(', ')}) or --minimal.`);
118
+ }
119
+ return lines;
120
+ }
121
+ exports.SPAWN_FOLLOW_POLL_MS = 3_000;
122
+ /** Longer than an install has taken; past it the CLI says where to read the receipt instead. */
123
+ exports.SPAWN_FOLLOW_MAX_WAIT_MS = 10 * 60 * 1000;
124
+ /**
125
+ * Follow a spawn the server answered 202 for until it reports a receipt or a failure. The install is
126
+ * not cut short by the edge's 60 s any more, but its receipt used to be lost with the 504 (OSK-22623).
127
+ * A read that fails (a 5xx, the network) is waited through; a 4xx other than "not yet" is the answer.
128
+ */
129
+ async function followSpawnOperation(options) {
130
+ const { operationId, read = async (id) => (await proactiveApi_1.proactiveApi.spawnOperation(id)).operation, sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), now = Date.now, pollMs = exports.SPAWN_FOLLOW_POLL_MS, maxWaitMs = exports.SPAWN_FOLLOW_MAX_WAIT_MS, onWaiting, } = options;
131
+ const startedAt = now();
132
+ for (;;) {
133
+ let operation;
134
+ try {
135
+ operation = await read(operationId);
136
+ }
137
+ catch (error) {
138
+ const status = (0, http_error_1.httpStatusOf)(error);
139
+ if (status !== undefined && status < 500)
140
+ throw error;
141
+ }
142
+ if (operation?.state === 'succeeded' && operation.result) {
143
+ return { kind: 'done', result: operation.result };
144
+ }
145
+ if (operation?.state === 'failed') {
146
+ const body = operation.failure?.body;
147
+ return {
148
+ kind: 'failed',
149
+ message: body?.error || body?.message || 'The install failed.',
150
+ ...(body?.code ? { code: body.code } : {}),
151
+ };
152
+ }
153
+ if (operation?.state === 'unknown')
154
+ return { kind: 'quiet' };
155
+ const elapsed = now() - startedAt;
156
+ if (elapsed >= maxWaitMs)
157
+ return { kind: 'timeout' };
158
+ onWaiting?.(elapsed);
159
+ await sleep(pollMs);
160
+ }
161
+ }
162
+ /** What `--minimal` / `--without` say when the server cannot honour them. */
163
+ exports.DECLINE_UNSUPPORTED_MESSAGE = 'This server does not support --minimal/--without yet; nothing was opted out.';
87
164
  /** A value as one POSIX shell word, so a printed command can be pasted as it is. */
88
165
  function shellQuote(value) {
89
166
  return `'${value.replace(/'/g, `'\\''`)}'`;
@@ -166,6 +243,21 @@ function proactiveInstallReadiness(result, bin) {
166
243
  : `${bin} commitments list --agent ${safeAgentId ?? '<agent-id>'} --status draft`,
167
244
  };
168
245
  }
246
+ // A draft held only because Always-On is off names that gate in its `blockedBy` (no activation
247
+ // diagnostic exists, since nothing refused it). The repair is turning Always-On on, not a dry
248
+ // run; `commitments preflight` told the owner so one step later (OSK-22629).
249
+ const heldByAlwaysOff = affected.length > 0 &&
250
+ affected.every((commitment) => commitment.status === 'draft' &&
251
+ (commitment.blockedBy || []).some((entry) => entry.gate === 'always_on' && entry.reason === 'always_on_disabled'));
252
+ if (heldByAlwaysOff && safeAgentId && ids.length) {
253
+ return {
254
+ status: 'degraded',
255
+ message: `Always-On is off, so the Commitment${ids.length === 1 ? '' : 's'} ${ids.join(', ')} ` +
256
+ `${ids.length === 1 ? 'was' : 'were'} left as ${ids.length === 1 ? 'a draft' : 'drafts'}. ` +
257
+ 'Turn Always-On on if you want it to run, then resume it.',
258
+ repairCommand: `${bin} agents always-on enable ${safeAgentId}`,
259
+ };
260
+ }
169
261
  return {
170
262
  status: 'degraded',
171
263
  message: ids.length
@@ -264,6 +356,8 @@ class AgentsSpawn extends base_command_1.BaseCommand {
264
356
  '<%= config.bin %> agents spawn --apply-recommendation par_123 --spec-hash <reviewed-hash>',
265
357
  '<%= config.bin %> agents spawn --print-spec-template > spec.json',
266
358
  '<%= config.bin %> agents spawn --from-spec spec.json --approve',
359
+ '<%= config.bin %> agents spawn --from-spec spec.json --minimal --approve',
360
+ '<%= config.bin %> agents spawn --from-spec spec.json --without memory_watcher --without relationship_loops --approve',
267
361
  ];
268
362
  static args = {
269
363
  sentence: core_1.Args.string({
@@ -291,9 +385,20 @@ class AgentsSpawn extends base_command_1.BaseCommand {
291
385
  'from-spec': core_1.Flags.string({
292
386
  description: 'Path to a spec JSON (or "-" for stdin) to apply directly (requires --approve). Its shape is under SPEC FORMAT below; --print-spec-template prints a valid one. An explicit empty systems list skips implicit baseline watchers.',
293
387
  }),
388
+ follow: core_1.Flags.string({
389
+ description: 'Read the receipt of an install that outlived its request, by the operation id the 202 named, and exit',
390
+ }),
294
391
  'print-spec-template': core_1.Flags.boolean({
295
392
  description: 'Print a valid spec JSON to edit and pass to --from-spec, and exit (creates nothing)',
296
393
  }),
394
+ minimal: core_1.Flags.boolean({
395
+ description: 'Install only what the spec asks for: decline every default the platform would add (the memory and task/goal scans, the initiative follow-through loop, the four relationship loops). The plan lists each default first',
396
+ }),
397
+ without: core_1.Flags.string({
398
+ description: `Decline one default by name; repeatable. One of: ${proactiveApi_1.DECLINABLE_DEFAULTS.join(', ')}. Refused when the spec itself asks for it`,
399
+ options: [...proactiveApi_1.DECLINABLE_DEFAULTS],
400
+ multiple: true,
401
+ }),
297
402
  'agent-id': core_1.Flags.string({
298
403
  description: 'Apply onto an existing agent instead of creating a new one (convergent re-run)',
299
404
  }),
@@ -314,6 +419,22 @@ class AgentsSpawn extends base_command_1.BaseCommand {
314
419
  return;
315
420
  }
316
421
  this.requireAuth();
422
+ if (flags.follow) {
423
+ try {
424
+ const result = await this.followToReceipt(flags.follow);
425
+ this.renderApplyResult(result, flags.json, false);
426
+ }
427
+ catch (err) {
428
+ this.handleApiError(err);
429
+ }
430
+ return;
431
+ }
432
+ // A recommendation is approved and applied as reviewed, with no way to decline a default;
433
+ // refusing here is better than a --minimal that silently installs everything.
434
+ if ((flags.minimal || (flags.without ?? []).length > 0) &&
435
+ (flags['approve-recommendation'] || flags['apply-recommendation'] || flags.recommend)) {
436
+ this.error('--minimal and --without apply to --from-spec and to a sentence, not to a recommendation. Apply the spec directly instead.', { exit: 1 });
437
+ }
317
438
  if (flags.recommend && flags['from-spec']) {
318
439
  this.error('--recommend cannot be combined with --from-spec. Use a sentence with --recommend, or review the spec and apply it with --from-spec and --approve.', { exit: 1 });
319
440
  }
@@ -337,6 +458,114 @@ class AgentsSpawn extends base_command_1.BaseCommand {
337
458
  this.handleApiError(err);
338
459
  }
339
460
  }
461
+ /** `--minimal` / `--without`, as the request body carries them. */
462
+ declineOptions(flags) {
463
+ return {
464
+ ...(flags.minimal ? { minimal: true } : {}),
465
+ ...((flags.without ?? []).length > 0 ? { without: flags.without } : {}),
466
+ };
467
+ }
468
+ /**
469
+ * The install plan for a spec, or null when this server cannot answer. The preview is a read; an
470
+ * older server has no such route, and the spec preview beside it still stands. A 400 is the
471
+ * answer (a refused option or spec), not a missing plan, so it is rethrown.
472
+ */
473
+ async readInstallPlan(spec, flags, fromReviewedSpec) {
474
+ try {
475
+ const preview = await proactiveApi_1.proactiveApi.previewProactiveAgentSpec({
476
+ spec,
477
+ ...(flags['agent-id'] ? { agentId: flags['agent-id'] } : {}),
478
+ ...(flags.timezone ? { timezone: flags.timezone } : {}),
479
+ fromReviewedSpec,
480
+ ...this.declineOptions(flags),
481
+ });
482
+ return preview.items;
483
+ }
484
+ catch (err) {
485
+ if ((0, http_error_1.httpStatusOf)(err) === 400)
486
+ throw err;
487
+ return null;
488
+ }
489
+ }
490
+ async printInstallPlan(spec, flags, fromReviewedSpec) {
491
+ const items = await this.readInstallPlan(spec, flags, fromReviewedSpec);
492
+ this.log('');
493
+ if (!items) {
494
+ this.log('(The install plan could not be read from this server; the spec above is what you reviewed.)');
495
+ return;
496
+ }
497
+ for (const line of installPlanLines(items, this.config.bin))
498
+ this.log(line);
499
+ }
500
+ /**
501
+ * An apply answer in hand: a receipt passes through; a `202` is followed to its receipt. An install
502
+ * takes longer than the edge allows, and the CLI used to print a 504 for one that completed with its
503
+ * receipt lost (OSK-22623).
504
+ */
505
+ async resolveApplyAnswer(answer) {
506
+ if (!(0, proactiveApi_1.isSpawnAccepted)(answer))
507
+ return answer;
508
+ process.stderr.write(`The install is running on the server (operation ${answer.operation.id}); waiting for its receipt...\n`);
509
+ return this.followToReceipt(answer.operation.id);
510
+ }
511
+ async followToReceipt(operationId) {
512
+ const outcome = await followSpawnOperation({ operationId });
513
+ if (outcome.kind === 'done')
514
+ return outcome.result;
515
+ const again = `${this.config.bin} agents spawn --follow ${operationId}`;
516
+ if (outcome.kind === 'failed') {
517
+ return this.error(`The install failed: ${outcome.message}${outcome.code ? ` (${outcome.code})` : ''}`, {
518
+ exit: 1,
519
+ });
520
+ }
521
+ if (outcome.kind === 'quiet') {
522
+ return this.error(`The server no longer reports on this install (operation ${operationId}); it may have been interrupted. ` +
523
+ `Check what exists with \`${this.config.bin} agents list\`; applying the same spec with --agent-id converges it.`, { exit: 1 });
524
+ }
525
+ return this.error(`The install is still running after ${Math.round(exports.SPAWN_FOLLOW_MAX_WAIT_MS / 60000)} minutes. ` +
526
+ `It was not cut short; read its receipt with \`${again}\`.`, { exit: 1 });
527
+ }
528
+ /**
529
+ * Refuse BEFORE creating anything when `--minimal` / `--without` were asked for and this server
530
+ * cannot honour them. A server that predates the options ignores them, applies every default and
531
+ * answers 200, which looked exactly like a successful opt-out (OSK-22586). The preview route is
532
+ * read-only and arrived with the options, so a server that answers it also applies them; a 404
533
+ * means it does not. Any other failure is thrown as it is: the apply is not attempted either way.
534
+ */
535
+ async assertServerDeclinesDefaults(spec, flags, fromReviewedSpec) {
536
+ if (!flags.minimal && (flags.without ?? []).length === 0)
537
+ return;
538
+ try {
539
+ const preview = await proactiveApi_1.proactiveApi.previewProactiveAgentSpec({
540
+ spec,
541
+ ...(flags['agent-id'] ? { agentId: flags['agent-id'] } : {}),
542
+ ...(flags.timezone ? { timezone: flags.timezone } : {}),
543
+ fromReviewedSpec,
544
+ ...this.declineOptions(flags),
545
+ });
546
+ if (preview && Array.isArray(preview.items) && preview.options)
547
+ return;
548
+ }
549
+ catch (err) {
550
+ const status = (0, http_error_1.httpStatusOf)(err);
551
+ if (status !== 404 && status !== 405 && status !== 501)
552
+ throw err;
553
+ }
554
+ this.error(exports.DECLINE_UNSUPPORTED_MESSAGE, { exit: 1 });
555
+ }
556
+ /**
557
+ * After the apply: the server must say it applied the options. Covers a rolling deploy where the
558
+ * preview was answered by a new instance and the apply by an old one. The Agent then exists with
559
+ * every default, so the error names it.
560
+ */
561
+ assertDeclinesApplied(result, flags) {
562
+ if (!flags.minimal && (flags.without ?? []).length === 0)
563
+ return;
564
+ if (result.installOptions)
565
+ return;
566
+ this.error(`${exports.DECLINE_UNSUPPORTED_MESSAGE} The Agent ${result.agentId} was created with every default; ` +
567
+ `see what it holds with \`${this.config.bin} agents triggers list ${result.agentId}\`.`, { exit: 1 });
568
+ }
340
569
  async runFromSpec(flags) {
341
570
  const body = await (0, prompt_1.readJsonBody)(flags['from-spec']);
342
571
  const spec = (body.spec ?? body);
@@ -346,17 +575,22 @@ class AgentsSpawn extends base_command_1.BaseCommand {
346
575
  return;
347
576
  }
348
577
  this.renderSpec(spec);
578
+ await this.printInstallPlan(spec, flags, true);
349
579
  this.log('');
350
580
  this.log('This is a spec preview — re-run with --approve to create the agent.');
351
581
  return;
352
582
  }
353
- const result = await proactiveApi_1.proactiveApi.applyProactiveAgentSpec({
583
+ await this.assertServerDeclinesDefaults(spec, flags, true);
584
+ const applied = await proactiveApi_1.proactiveApi.applyProactiveAgentSpec({
354
585
  spec,
355
586
  ...(flags['agent-id'] ? { agentId: flags['agent-id'] } : {}),
356
587
  ...(flags.timezone ? { timezone: flags.timezone } : {}),
357
588
  fromReviewedSpec: true,
589
+ ...this.declineOptions(flags),
358
590
  });
591
+ const result = await this.resolveApplyAnswer(applied);
359
592
  this.renderApplyResult(result, flags.json, Boolean(flags['agent-id']));
593
+ this.assertDeclinesApplied(result, flags);
360
594
  }
361
595
  async runFromSentence(sentence, flags) {
362
596
  const history = (flags.message ?? []).map((content) => ({
@@ -406,7 +640,12 @@ class AgentsSpawn extends base_command_1.BaseCommand {
406
640
  const spec = plan.spec;
407
641
  if (!flags.approve) {
408
642
  if (flags.json) {
409
- this.printJsonResult({ ...plan, spec: specWithEffectiveWindowFlags(spec) });
643
+ const installPlan = await this.readInstallPlan(spec, flags, false);
644
+ this.printJsonResult({
645
+ ...plan,
646
+ spec: specWithEffectiveWindowFlags(spec),
647
+ ...(installPlan ? { installPlan } : {}),
648
+ });
410
649
  return;
411
650
  }
412
651
  // The planner's own sentence about the plan (and any note about a value it
@@ -416,12 +655,15 @@ class AgentsSpawn extends base_command_1.BaseCommand {
416
655
  this.log('');
417
656
  }
418
657
  this.renderSpec(spec);
658
+ await this.printInstallPlan(spec, flags, false);
419
659
  this.log('');
420
660
  this.log('This is a draft — nothing has been created.');
421
661
  const repeat = [
422
662
  shellQuote(sentence),
423
663
  ...(flags.name ? ['--name', shellQuote(flags.name)] : []),
424
664
  ...(flags.timezone ? ['--timezone', shellQuote(flags.timezone)] : []),
665
+ ...(flags.minimal ? ['--minimal'] : []),
666
+ ...(flags.without ?? []).flatMap((name) => ['--without', name]),
425
667
  '--approve',
426
668
  ].join(' ');
427
669
  this.log(` Create it: ${this.config.bin} agents spawn ${repeat}`);
@@ -430,13 +672,17 @@ class AgentsSpawn extends base_command_1.BaseCommand {
430
672
  this.log(' --from-spec spec.json --approve');
431
673
  return;
432
674
  }
433
- const result = await proactiveApi_1.proactiveApi.applyProactiveAgentSpec({
675
+ await this.assertServerDeclinesDefaults(spec, flags, false);
676
+ const applied = await proactiveApi_1.proactiveApi.applyProactiveAgentSpec({
434
677
  spec,
435
678
  ...(flags['agent-id'] ? { agentId: flags['agent-id'] } : {}),
436
679
  ...(flags.timezone ? { timezone: flags.timezone } : {}),
437
680
  fromReviewedSpec: false,
681
+ ...this.declineOptions(flags),
438
682
  });
683
+ const result = await this.resolveApplyAnswer(applied);
439
684
  this.renderApplyResult(result, flags.json, Boolean(flags['agent-id']));
685
+ this.assertDeclinesApplied(result, flags);
440
686
  }
441
687
  async runRecommendationAction(flags) {
442
688
  if (flags['apply-recommendation'] && !flags['spec-hash']?.trim()) {
@@ -581,7 +827,13 @@ class AgentsSpawn extends base_command_1.BaseCommand {
581
827
  }
582
828
  const compass = result.installed.compass;
583
829
  if (compass) {
584
- this.log(` compass: ${compass.skipped ? `kept the existing one (${compass.skipped})` : compass.ok ? 'installed' : 'failed'}`);
830
+ this.log(` compass: ${compass.skipped === 'compass_unchanged'
831
+ ? 'already in place (unchanged)'
832
+ : compass.skipped
833
+ ? `kept the existing one (${compass.skipped})`
834
+ : compass.ok
835
+ ? 'installed'
836
+ : 'failed'}`);
585
837
  }
586
838
  const seeded = initializeSummary(result.installed.initialize);
587
839
  if (seeded)
@@ -596,6 +848,23 @@ class AgentsSpawn extends base_command_1.BaseCommand {
596
848
  const state = watcher.enabled == null ? 'unknown' : watcher.enabled ? 'enabled' : 'disabled';
597
849
  this.log(` ${watcher.source}: ${state}` + (watcher.triggerId ? ` (${watcher.triggerId})` : ''));
598
850
  }
851
+ // Everything that now exists on the Agent, read back: the creation-time seed and the baseline
852
+ // watchers are not in the lines above, which is how a one-watcher spec read as one (OSK-22417).
853
+ const inventory = result.installed.inventory;
854
+ if (inventory?.triggers?.length) {
855
+ this.log(' triggers on this agent:');
856
+ for (const trigger of inventory.triggers) {
857
+ this.log(` ${trigger.origin.padEnd(9)} ${trigger.label ?? trigger.source ?? '(unnamed)'}` +
858
+ ` - ${trigger.enabled ? 'enabled' : 'disabled'} (${trigger.id})`);
859
+ }
860
+ }
861
+ if (inventory?.commitments?.length) {
862
+ this.log(' system commitments on this agent:');
863
+ for (const commitment of inventory.commitments) {
864
+ this.log(` ${commitment.systemRole ?? commitment.title ?? '(unnamed)'}` +
865
+ ` - ${commitment.status ?? 'unknown'} (${commitment.id})`);
866
+ }
867
+ }
599
868
  if (result.warnings.length > 0) {
600
869
  this.log(' warnings:');
601
870
  for (const warning of result.warnings) {
@@ -50,6 +50,26 @@ class AgentsTriggersFire extends base_command_1.BaseCommand {
50
50
  this.error(err.message, { exit: 4 });
51
51
  this.handleApiError(err);
52
52
  }
53
+ // A watcher fire can run for minutes; the server answers 202 with the occurrence once it has
54
+ // outlived a short wait, and the result is followed here (OSK-22624).
55
+ const settled = await (0, triggers_1.settleFireAnswer)({
56
+ triggerId: args.triggerId,
57
+ agentId: args.agentId,
58
+ bin: this.config.bin,
59
+ answer: result,
60
+ note: (line) => process.stderr.write(`${line}\n`),
61
+ });
62
+ if (settled.running) {
63
+ if (flags.json) {
64
+ this.printJsonResult({ ...settled.answer, ok: true });
65
+ }
66
+ else {
67
+ this.log(`Fire accepted and still running (occurrence ${settled.answer.occurrenceId ?? '-'}).`);
68
+ this.log(`Read its result later: ${settled.command}`);
69
+ }
70
+ return;
71
+ }
72
+ result = settled.result;
53
73
  const refused = flags.strict && !(0, triggers_1.fireWasAccepted)(result);
54
74
  const refusal = refused ? (0, triggers_1.describeStrictFireRefusal)(result) : null;
55
75
  if (flags.json) {
@@ -31,6 +31,7 @@ export default class AgentsUpcoming extends BaseCommand {
31
31
  kinds: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
32
32
  expand: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
33
33
  cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
34
+ timezone: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
34
35
  };
35
36
  run(): Promise<void>;
36
37
  }
@@ -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 format_1 = require("../../lib/format");
7
+ const schedule_1 = require("../../lib/schedule");
7
8
  const triggers_1 = require("../../lib/triggers");
8
9
  const UPCOMING_KINDS = ['message', 'agent_trigger'];
9
10
  /**
@@ -51,11 +52,18 @@ class AgentsUpcoming extends base_command_1.BaseCommand {
51
52
  options: ['first', 'all'],
52
53
  }),
53
54
  cursor: core_1.Flags.string({ description: 'Pagination cursor (nextCursor from a previous page)' }),
55
+ timezone: core_1.Flags.string({
56
+ description: "IANA timezone the times are shown in (defaults to this machine's timezone, as in schedule-trace and plan-day). --json keeps UTC.",
57
+ }),
54
58
  };
55
59
  async run() {
56
60
  this.requireAuth();
57
61
  const { args, flags } = await this.parse(AgentsUpcoming);
58
62
  const kinds = (0, triggers_1.splitRepeated)(flags.kinds);
63
+ const zone = (0, schedule_1.resolveDayTimeZone)(flags.timezone);
64
+ if (!zone) {
65
+ this.error(`Invalid IANA timezone: ${flags.timezone}`, { exit: 1 });
66
+ }
59
67
  let response;
60
68
  try {
61
69
  response = await data_provider_1.dataService.getUpcoming({
@@ -82,13 +90,17 @@ class AgentsUpcoming extends base_command_1.BaseCommand {
82
90
  : `Nothing upcoming for agent ${args.id}.`);
83
91
  return;
84
92
  }
93
+ // Times are shown in one named zone, like the rest of the schedule output;
94
+ // server-written text (a prompt preview, a fallback caption) can still embed
95
+ // a UTC instant, so those are rewritten into the same zone (OSK-22588).
96
+ this.log(`Times in ${(0, schedule_1.describeTimeZone)(zone)}`);
85
97
  (0, format_1.renderTable)(items.map((item) => ({
86
- when: formatFireAt(item.fireAt),
98
+ when: formatFireAt(item.fireAt, zone),
87
99
  kind: item.kind,
88
- title: titleOf(item),
89
- detail: detailOf(item),
100
+ title: (0, format_1.localizeIsoInstants)(titleOf(item), zone),
101
+ detail: (0, format_1.localizeIsoInstants)(detailOf(item), zone),
90
102
  })), [
91
- { key: 'when', header: 'WHEN', maxWidth: 26 },
103
+ { key: 'when', header: 'WHEN', maxWidth: 28 },
92
104
  { key: 'kind', header: 'KIND', maxWidth: 14 },
93
105
  { key: 'title', header: 'TITLE', maxWidth: 36 },
94
106
  { key: 'detail', header: 'DETAIL', maxWidth: 48 },
@@ -100,9 +112,8 @@ class AgentsUpcoming extends base_command_1.BaseCommand {
100
112
  }
101
113
  }
102
114
  exports.default = AgentsUpcoming;
103
- function formatFireAt(iso) {
104
- const d = new Date(iso);
105
- return Number.isNaN(d.getTime()) ? iso : d.toISOString();
115
+ function formatFireAt(iso, zone) {
116
+ return (0, format_1.zonedTime)(iso, zone, { seconds: false });
106
117
  }
107
118
  /** A human title for either upcoming-item shape. */
108
119
  function titleOf(item) {
@@ -343,7 +343,7 @@ JSON
343
343
  description: 'Watched source the criterion reads (implies --evaluator source_state), e.g. github',
344
344
  }),
345
345
  watch: core_1.Flags.string({
346
- description: `Watched source (repeatable). One of: ${commitments_1.COMMITMENT_WATCHED_SOURCES.join(', ')}. Some sources need companion flags: --watch-space, --watch-monitor, --metric-key.`,
346
+ description: `Watched source (repeatable). One of: ${commitments_1.COMMITMENT_WATCHED_SOURCES.join(', ')}. Some sources need companion flags: --watch-space, --watch-monitor, --metric-key. conversations and messages need an id (config.conversationId, config.groupChatId) that only --from-json can set.`,
347
347
  multiple: true,
348
348
  options: [...commitments_1.COMMITMENT_WATCHED_SOURCES],
349
349
  }),
@@ -120,7 +120,7 @@ JSON
120
120
  description: 'Watched source the criterion reads (implies --evaluator source_state), e.g. github',
121
121
  }),
122
122
  watch: core_1.Flags.string({
123
- description: 'Watched source (repeatable). Replaces the selected set and retains config for matching bindings. Some sources need companion flags: --watch-space, --watch-monitor.',
123
+ description: 'Watched source (repeatable). Replaces the selected set and retains config for matching bindings. Some sources need companion flags: --watch-space, --watch-monitor. conversations and messages need an id (config.conversationId, config.groupChatId) that only --from-json can set.',
124
124
  multiple: true,
125
125
  options: [...commitments_1.COMMITMENT_WATCHED_SOURCES],
126
126
  }),
@@ -98,6 +98,10 @@ class SpacesWorkflowTemplatesInsert extends base_command_1.BaseCommand {
98
98
  }
99
99
  // Someone saved between the read and the write. Only the revision pair
100
100
  // was stale, so one re-read makes the identical request valid again.
101
+ // Say so on stderr (stdout and --json stay parseable): the server answered
102
+ // 409, and a person who never hears that cannot tell their insert was
103
+ // judged against a canvas someone else had just changed (OSK-22622).
104
+ this.warn('The draft changed while inserting (409 WORKFLOW_DRAFT_CONFLICT); re-read it and inserted again.');
101
105
  try {
102
106
  result = await attempt();
103
107
  }
@@ -156,6 +156,28 @@ class StoreShow extends base_command_1.BaseCommand {
156
156
  this.log(line);
157
157
  }
158
158
  this.log(` ${store_listing_1.CAPABILITY_DISCLOSURE_FOOTNOTE}`);
159
+ // ── Skills it needs ──
160
+ // The install is refused until the required ones are installed, and the disclosure above names
161
+ // them only as ids, so say it here, by name, with the command (OSK-22547).
162
+ const currentRelease = (releases.value?.data ?? []).find((r) => r.id === listing.latestReleaseId) ??
163
+ releases.value?.data?.[0];
164
+ const skillDependencies = (currentRelease?.dependencies ?? []).filter((dependency) => dependency.entityType === 'skill');
165
+ const skillLabel = (dependency) => dependency.name ? `${dependency.name} (${dependency.entityId})` : dependency.entityId;
166
+ const requiredSkills = skillDependencies.filter((dependency) => dependency.required);
167
+ const optionalSkills = skillDependencies.filter((dependency) => !dependency.required);
168
+ if (requiredSkills.length > 0) {
169
+ this.log('');
170
+ this.log(`Requires ${requiredSkills.length} Skill${requiredSkills.length === 1 ? '' : 's'}: ` +
171
+ `${requiredSkills.map(skillLabel).join(', ')}`);
172
+ this.log(' The install is refused until you have them. Install each first:');
173
+ for (const dependency of requiredSkills) {
174
+ this.log(` ${this.config.bin} skills install ${dependency.entityId}`);
175
+ }
176
+ }
177
+ if (optionalSkills.length > 0) {
178
+ this.log('');
179
+ this.log(`Works better with: ${optionalSkills.map(skillLabel).join(', ')}`);
180
+ }
159
181
  // ── Releases ──
160
182
  this.log('');
161
183
  this.log(`Current release: ${version}${listing.releaseNumber ? ` (release ${listing.releaseNumber})` : ''}` +
@@ -71,7 +71,7 @@ class TriggersAudit extends base_command_1.BaseCommand {
71
71
  this.log(JSON.stringify(response, null, 2));
72
72
  return;
73
73
  }
74
- (0, triggers_1.renderFireAudit)(response.fires ?? [], (line) => this.log(line));
74
+ (0, triggers_1.renderFireAudit)(response.fires ?? [], (line) => this.log(line), response.waiting);
75
75
  }
76
76
  }
77
77
  exports.default = TriggersAudit;
@@ -44,6 +44,25 @@ class TriggersFire extends base_command_1.BaseCommand {
44
44
  catch (err) {
45
45
  this.handleApiError(err);
46
46
  }
47
+ // A watcher fire can run for minutes; the server answers 202 with the occurrence once it has
48
+ // outlived a short wait, and the result is followed here (OSK-22624).
49
+ const settled = await (0, triggers_1.settleFireAnswer)({
50
+ triggerId: args.id,
51
+ bin: this.config.bin,
52
+ answer: result,
53
+ note: (line) => process.stderr.write(`${line}\n`),
54
+ });
55
+ if (settled.running) {
56
+ if (flags.json) {
57
+ this.printJsonResult({ ...settled.answer, ok: true });
58
+ }
59
+ else {
60
+ this.log(`Fire accepted and still running (occurrence ${settled.answer.occurrenceId ?? '-'}).`);
61
+ this.log(`Read its result later: ${settled.command}`);
62
+ }
63
+ return;
64
+ }
65
+ result = settled.result;
47
66
  const accepted = (0, triggers_1.fireWasAccepted)(result);
48
67
  if (flags.json) {
49
68
  // `ok` and the exit status are one answer: a strict refusal prints `ok: false` and why,