@skrr-ai/cli 0.1.135 → 0.1.137

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.
@@ -1,10 +1,13 @@
1
1
  import { BaseCommand } from '../../base-command';
2
- import { type ApplyProactiveAgentResponse } from '../../lib/proactiveApi';
2
+ import { type ProactiveAgentSpec, type ApplyProactiveAgentResponse } from '../../lib/proactiveApi';
3
3
  export type ProactiveInstallReadiness = {
4
4
  status: 'ready' | 'degraded';
5
5
  message: string;
6
6
  repairCommand?: string;
7
7
  };
8
+ export declare function workerPolicyWindowLines(policy: NonNullable<ProactiveAgentSpec['worker']>['policy']): string[];
9
+ /** JSON previews show the effective disabled state without mutating the input spec. */
10
+ export declare function specWithEffectiveWindowFlags(spec: ProactiveAgentSpec): ProactiveAgentSpec;
8
11
  /**
9
12
  * Agent identity creation is intentionally forward-only, but an Agent URL must
10
13
  * not masquerade as a fully installed proactive service when a watcher or
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.workerPolicyWindowLines = workerPolicyWindowLines;
4
+ exports.specWithEffectiveWindowFlags = specWithEffectiveWindowFlags;
3
5
  exports.proactiveInstallReadiness = proactiveInstallReadiness;
4
6
  const core_1 = require("@oclif/core");
5
7
  const base_command_1 = require("../../base-command");
@@ -7,6 +9,40 @@ const prompt_1 = require("../../lib/prompt");
7
9
  const format_1 = require("../../lib/format");
8
10
  const web_url_1 = require("../../lib/web-url");
9
11
  const proactiveApi_1 = require("../../lib/proactiveApi");
12
+ function workerPolicyWindowLines(policy) {
13
+ const lines = [];
14
+ for (const [label, window] of [
15
+ ['Working hours', policy?.workingHours],
16
+ ['Quiet hours', policy?.quietHours],
17
+ ]) {
18
+ if (!window)
19
+ continue;
20
+ const state = window.enabled === undefined
21
+ ? 'disabled; enabled not specified'
22
+ : window.enabled ? 'enabled' : 'disabled';
23
+ lines.push(` ${label}: ${window.start}–${window.end} ${window.timezone ?? '(no zone recorded)'} (${state})`);
24
+ }
25
+ return lines;
26
+ }
27
+ /** JSON previews show the effective disabled state without mutating the input spec. */
28
+ function specWithEffectiveWindowFlags(spec) {
29
+ const policy = spec.worker?.policy;
30
+ if (!spec.worker || !policy)
31
+ return spec;
32
+ const workingHours = policy.workingHours && { ...policy.workingHours, enabled: policy.workingHours.enabled ?? false };
33
+ const quietHours = policy.quietHours && { ...policy.quietHours, enabled: policy.quietHours.enabled ?? false };
34
+ return {
35
+ ...spec,
36
+ worker: {
37
+ ...spec.worker,
38
+ policy: {
39
+ ...policy,
40
+ ...(workingHours ? { workingHours } : {}),
41
+ ...(quietHours ? { quietHours } : {}),
42
+ },
43
+ },
44
+ };
45
+ }
10
46
  /**
11
47
  * Agent identity creation is intentionally forward-only, but an Agent URL must
12
48
  * not masquerade as a fully installed proactive service when a watcher or
@@ -23,6 +59,18 @@ function proactiveInstallReadiness(result, bin) {
23
59
  message: 'The Agent is off. Review the setup warnings and enable Always-On explicitly if you want it to run.',
24
60
  };
25
61
  }
62
+ if (result.warnings.some((warning) => warning.code === 'compass_existing_not_replaced')) {
63
+ return {
64
+ status: 'degraded',
65
+ message: 'The requested standing direction was not installed. Review the existing Compass and the setup warnings.',
66
+ };
67
+ }
68
+ if (result.warnings.some((warning) => warning.code === 'policy_window_enabled_unspecified')) {
69
+ return {
70
+ status: 'degraded',
71
+ message: 'Some worker time windows are disabled because their enablement was not specified. Review the warnings.',
72
+ };
73
+ }
26
74
  // A full trigger budget must not make a new persona-only Agent look broken
27
75
  // when its core system commitments, local execution policy, and Always-On
28
76
  // state installed successfully. The optional backlog watcher is deferred;
@@ -135,7 +183,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
135
183
  const spec = (body.spec ?? body);
136
184
  if (!flags.approve) {
137
185
  if (flags.json) {
138
- this.log(JSON.stringify(spec, null, 2));
186
+ this.log(JSON.stringify(specWithEffectiveWindowFlags(spec), null, 2));
139
187
  return;
140
188
  }
141
189
  this.renderSpec(spec);
@@ -192,7 +240,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
192
240
  const spec = plan.spec;
193
241
  if (!flags.approve) {
194
242
  if (flags.json) {
195
- this.log(JSON.stringify(plan, null, 2));
243
+ this.log(JSON.stringify({ ...plan, spec: specWithEffectiveWindowFlags(spec) }, null, 2));
196
244
  return;
197
245
  }
198
246
  this.renderSpec(spec);
@@ -244,6 +292,8 @@ class AgentsSpawn extends base_command_1.BaseCommand {
244
292
  if (spec.worker) {
245
293
  this.log('');
246
294
  this.log(`Worker (event-reactive) — policy: ${spec.worker.policy?.mode ?? 'ask_first'}`);
295
+ for (const line of workerPolicyWindowLines(spec.worker.policy))
296
+ this.log(line);
247
297
  (0, format_1.renderTable)(spec.worker.watchers.map((w) => ({
248
298
  source: w.source,
249
299
  every: `${w.intervalMinutes ?? '-'}m`,
@@ -315,7 +315,7 @@ JSON
315
315
  activate: core_1.Flags.boolean({
316
316
  description: 'Turn the commitment on right after creating it — the same resume + Preflight boundary ' +
317
317
  "as `commitments resume`. A refused activation keeps the draft and reports the refusal's " +
318
- 'code, reason and fix.',
318
+ 'code, reason and fix, and exits nonzero. Use the returned ID to resume it instead of creating another.',
319
319
  }),
320
320
  deadline: core_1.Flags.string({ description: 'ISO-8601 deadline for an `achieve` commitment' }),
321
321
  criterion: core_1.Flags.string({
@@ -593,6 +593,10 @@ JSON
593
593
  }
594
594
  }
595
595
  }
596
+ // A draft was created, but the requested operation did not fully succeed.
597
+ // Keep the receipt on stdout and let it drain before returning a failure to scripts.
598
+ if (activation && !activation.activated)
599
+ process.exitCode = 1;
596
600
  const warnings = (0, commitments_1.commitmentWriteWarnings)(commitment, { payload });
597
601
  if (flags.json) {
598
602
  this.log(JSON.stringify((0, web_url_1.withCommitmentUrl)(this.cliConfig.baseURL, {
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ export default class SpaceAutoDreamStatus extends BaseCommand {
3
+ static description: string;
4
+ static args: {
5
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static flags: {
8
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ run(): Promise<void>;
11
+ }
@@ -0,0 +1,44 @@
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 api_fetch_1 = require("../../../lib/api-fetch");
6
+ class SpaceAutoDreamStatus extends base_command_1.BaseCommand {
7
+ static description = 'Show current Space AutoDream eligibility and the most recent recorded cycle';
8
+ static args = { id: core_1.Args.string({ description: 'Space ID or title', required: true, ignoreStdin: true }) };
9
+ static flags = { json: core_1.Flags.boolean({ description: 'Output as JSON' }) };
10
+ async run() {
11
+ this.requireAuth();
12
+ const { args, flags } = await this.parse(SpaceAutoDreamStatus);
13
+ const spaceId = await this.resolveSpaceReference(args.id);
14
+ let result;
15
+ try {
16
+ result = await (0, api_fetch_1.apiFetch)(`/api/spaces/${encodeURIComponent(spaceId)}/autodream`, {
17
+ credential: this.resolvedCredential,
18
+ });
19
+ }
20
+ catch (error) {
21
+ this.handleApiError(error, { subject: `space ${args.id}` });
22
+ }
23
+ if (flags.json) {
24
+ this.printJsonResult(result);
25
+ return;
26
+ }
27
+ const eligibility = {
28
+ principal_missing_or_revoked: 'No active execution principal is configured.',
29
+ principal_lead_mismatch: 'The execution principal no longer matches the Space lead.',
30
+ principal_configured_unverified: 'An execution principal is configured; its current access has not been verified by this status check.',
31
+ }[result.currentEligibility] || 'Current eligibility is unknown.';
32
+ this.log(`Current eligibility: ${eligibility}`);
33
+ this.log(`Checked at: ${result.checkedAt}`);
34
+ const cycle = result.latestRecordedCycle;
35
+ if (cycle) {
36
+ this.log(`Most recent recorded cycle: ${cycle.window} — ${cycle.outcome}${cycle.reason ? ` (${cycle.reason})` : ''}; completed ${cycle.completedAt}`);
37
+ }
38
+ else {
39
+ this.log('No recorded cycle. This does not establish whether a cycle was scheduled.');
40
+ }
41
+ this.log('Cycle receipts are best-effort; an unrecorded later cycle may exist.');
42
+ }
43
+ }
44
+ exports.default = SpaceAutoDreamStatus;
@@ -62,6 +62,10 @@ class SpacesProposalsList extends base_command_1.BaseCommand {
62
62
  if (!result.data.length) {
63
63
  for (const line of (0, space_proposals_1.emptySpaceInboxLines)(result.nextCursor))
64
64
  this.log(line);
65
+ if (!result.nextCursor) {
66
+ const bin = this.config?.bin || 'skrr';
67
+ this.log(`For AutoDream status, run: ${bin} spaces autodream status ${spaceId}`);
68
+ }
65
69
  }
66
70
  (0, format_1.renderTable)(result.data.map(space_proposals_1.spaceProposalRow), [
67
71
  { key: 'id', header: 'PROPOSAL', verbatim: true },
@@ -413,6 +413,9 @@ class TasksShow extends base_command_1.BaseCommand {
413
413
  this.log(line);
414
414
  for (const line of completionLines(completion, { read: completionRead }))
415
415
  this.log(line);
416
+ const pendingReview = (0, data_provider_1.describeTaskReviewPause)(t.driReview);
417
+ if (pendingReview)
418
+ this.log(`Agent review: ${pendingReview}`);
416
419
  const agents = Array.isArray(t.assigneeAgentIds) ? t.assigneeAgentIds : [];
417
420
  const users = Array.isArray(t.assigneeUserIds) ? t.assigneeUserIds : [];
418
421
  // Principals print as names, not ObjectIds — same rule as labels: a
@@ -13,6 +13,7 @@ export default class TriggersAudit extends BaseCommand {
13
13
  agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
14
  scope: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
15
  outcome: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ reason: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
17
  source: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
18
  };
18
19
  run(): Promise<void>;
@@ -9,6 +9,7 @@ class TriggersAudit extends base_command_1.BaseCommand {
9
9
  '<%= config.bin %> triggers audit <trigger-id>',
10
10
  '<%= config.bin %> triggers audit --agent <agent-id> --limit 50',
11
11
  '<%= config.bin %> triggers audit --scope agent --outcome failed --json',
12
+ '<%= config.bin %> triggers audit <trigger-id> --outcome skipped --reason debounced',
12
13
  '<%= config.bin %> triggers audit <trigger-id> --limit 50 --json',
13
14
  ];
14
15
  static args = {
@@ -25,8 +26,9 @@ class TriggersAudit extends base_command_1.BaseCommand {
25
26
  agent: core_1.Flags.string({ description: 'Agent ID filter for owner-wide audit history' }),
26
27
  scope: core_1.Flags.string({ description: 'Scope kind filter for owner-wide audit history' }),
27
28
  outcome: core_1.Flags.string({
28
- description: 'Outcome filter (succeeded, failed, skipped, incomplete, capped, ...); an unknown value is refused with the full list',
29
+ description: 'Exact outcome field (succeeded, failed, skipped, ...); use --reason for causes such as debounced',
29
30
  }),
31
+ reason: core_1.Flags.string({ description: 'Exact reason field (for example debounced or inside_quiet_hours)' }),
30
32
  source: core_1.Flags.string({
31
33
  description: 'Source filter (schedule, once, event, manual, webhook, replay, ...); an unknown value is refused with the full list',
32
34
  }),
@@ -39,7 +41,7 @@ class TriggersAudit extends base_command_1.BaseCommand {
39
41
  // dropped without a word, so `--outcome failed` listed succeeded rows and exited 0 (OSK-16474).
40
42
  // A filter now always reaches the filtered history, narrowed to that trigger; that history
41
43
  // covers triggers you own, which is said out loud rather than discovered.
42
- const filtered = [flags.outcome, flags.source, flags.scope, flags.agent].some((value) => value !== undefined);
44
+ const filtered = [flags.outcome, flags.reason, flags.source, flags.scope, flags.agent].some((value) => value !== undefined);
43
45
  if (triggerId && filtered && !flags.json) {
44
46
  this.warn('Filters read the fire history of triggers you own: a trigger shared with you but owned by someone else lists no rows here (omit the filters to read its own audit).');
45
47
  }
@@ -54,6 +56,7 @@ class TriggersAudit extends base_command_1.BaseCommand {
54
56
  scope: flags.scope,
55
57
  agentId: flags.agent,
56
58
  outcome: flags.outcome,
59
+ reason: flags.reason,
57
60
  source: flags.source,
58
61
  ...(triggerId ? { triggerId } : {}),
59
62
  });
@@ -25,6 +25,10 @@ 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}`);
31
+ }
28
32
  if (detail.durationMs !== undefined)
29
33
  lines.push(`Duration: ${String(detail.durationMs)}ms`);
30
34
  if (detail.conversationId)
@@ -96,11 +96,17 @@ class TriggersPrune extends base_command_1.BaseCommand {
96
96
  }
97
97
  if (ownerWide) {
98
98
  this.log('Scope: all (every scope you own)');
99
- this.log(`Per-user: ${quota.perUser} / ${quota.perUserLimit} (${quota.perUserRemaining} free)`);
99
+ this.log(`Owner quota${quota.counterWorkspaceId ? ` (workspace ${quota.counterWorkspaceId})` : quota.counterWorkspaceId === null ? ' (no workspace)' : ''}: ${quota.perUser} / ${quota.perUserLimit} (${quota.perUserRemaining} free)`);
100
100
  }
101
101
  else {
102
102
  this.log(`Scope: ${quota.scopeKind}`);
103
103
  this.log(`Active: ${quota.active} / ${quota.limit} (${quota.remaining} free)`);
104
+ if (quota.counterWorkspaceId !== undefined) {
105
+ this.log(`Quota workspace: ${quota.counterWorkspaceId || 'none'}`);
106
+ }
107
+ }
108
+ if (quota.reclaimableScope === 'owner_all_workspaces') {
109
+ this.log('Prune candidates span all workspaces you own.');
104
110
  }
105
111
  this.log(`Would delete: ${preview.wouldDelete} disabled trigger(s)`);
106
112
  for (const id of preview.ids)
@@ -49,6 +49,7 @@ export interface DedicatedLease extends Omit<HarnessLease, 'storage' | 'health'>
49
49
  retentionClass?: string;
50
50
  backupProfile?: string;
51
51
  lastBackupAt?: string;
52
+ lastBackupAtUncertain?: boolean;
52
53
  lastRestoreTestAt?: string;
53
54
  lastRestoreTestStatus?: string;
54
55
  unpaidSince?: string;
@@ -797,7 +797,9 @@ function describeDedicatedLease(lease, harnesses = [], opts = {}) {
797
797
  .filter(Boolean)
798
798
  .join(' · ');
799
799
  row('workspace', disk);
800
- row('last backup', storage.lastBackupAt);
800
+ row('last backup', storage.lastBackupAtUncertain
801
+ ? 'Unknown (recovery points could not be fully verified)'
802
+ : storage.lastBackupAt);
801
803
  const image = [resources.imageVersion || lease.daemon?.imageVersion].filter(Boolean).join('');
802
804
  row('image', image);
803
805
  if (lease.health?.image) {
@@ -1269,6 +1271,10 @@ function dedicatedCreateSummary(catalog, choices) {
1269
1271
  ` storage ${storage}${storagePrice?.display ? ` — ${storagePrice.display}` : ''}`,
1270
1272
  ` retention ${retention}${retains ? ' — destroy keeps the workspace, and its storage bills until you purge it' : ''}`,
1271
1273
  ` monthly cap ${cap}`,
1274
+ ...(capCents === null
1275
+ ? []
1276
+ : [' cap scope all Dedicated Runtime usage in this account or workspace']),
1277
+ ' admission not checked in this preview',
1272
1278
  ];
1273
1279
  }
1274
1280
  /**
@@ -154,6 +154,7 @@ export interface HarnessLease {
154
154
  storage?: {
155
155
  retentionClass?: string;
156
156
  lastBackupAt?: string;
157
+ lastBackupAtUncertain?: boolean;
157
158
  backupProfile?: string;
158
159
  };
159
160
  createdAt?: string;
@@ -7,6 +7,10 @@ export interface ProactiveWorkingHours {
7
7
  end: string;
8
8
  timezone?: string;
9
9
  }
10
+ /** Worker policy windows have an explicit enable switch; orchestrator hours do not. */
11
+ export interface ProactiveWorkerPolicyHours extends ProactiveWorkingHours {
12
+ enabled?: boolean;
13
+ }
10
14
  export interface SpecWatcher {
11
15
  source: WatcherSource;
12
16
  intervalMinutes?: number;
@@ -34,8 +38,8 @@ export interface ProactiveAgentSpec {
34
38
  maxAutoRunsPerDay?: number;
35
39
  cooldownMinutes?: number;
36
40
  requireApprovalRiskLevels?: string[];
37
- workingHours?: ProactiveWorkingHours;
38
- quietHours?: ProactiveWorkingHours;
41
+ workingHours?: ProactiveWorkerPolicyHours;
42
+ quietHours?: ProactiveWorkerPolicyHours;
39
43
  };
40
44
  };
41
45
  orchestrator?: {
@@ -583,6 +583,15 @@ export declare function renderTriggerSummary(trigger: TriggerDefinition, log: (l
583
583
  baseURL?: string;
584
584
  }): void;
585
585
  export declare function renderLegacyRuns(runs: LegacyTriggerRun[], log: (line: string) => void): void;
586
+ /** Human explanation for quiet-hour audit rows; a one-shot may have been re-armed. */
587
+ export declare function quietHoursAuditExplanation(fire: {
588
+ source?: unknown;
589
+ reason?: unknown;
590
+ outcome?: unknown;
591
+ }): {
592
+ summary: string;
593
+ detail: string;
594
+ } | null;
586
595
  export declare function renderFireAudit(fires: TriggerFireRecord[], log: (line: string) => void): void;
587
596
  /**
588
597
  * Trigger budget for one scope. `active` counts only ENABLED rows — a disabled
@@ -599,6 +608,9 @@ export interface TriggerQuotaStatus {
599
608
  perUser: number;
600
609
  perUserLimit: number;
601
610
  perUserRemaining: number;
611
+ /** Workspace used by the admission counter; null means the unscoped counter. */
612
+ counterWorkspaceId?: string | null;
613
+ reclaimableScope?: 'owner_all_workspaces';
602
614
  /**
603
615
  * Disabled rows across EVERY scope this user owns. `reclaimable` above is
604
616
  * scoped, which cannot size the remedy for a per-user refusal — that cap
@@ -53,6 +53,7 @@ exports.toolsRefusedHintLines = toolsRefusedHintLines;
53
53
  exports.fireRefusalLines = fireRefusalLines;
54
54
  exports.renderTriggerSummary = renderTriggerSummary;
55
55
  exports.renderLegacyRuns = renderLegacyRuns;
56
+ exports.quietHoursAuditExplanation = quietHoursAuditExplanation;
56
57
  exports.renderFireAudit = renderFireAudit;
57
58
  const data_provider_1 = require("@skrr-ai/data-provider");
58
59
  const node_fs_1 = require("node:fs");
@@ -1524,6 +1525,22 @@ function renderLegacyRuns(runs, log) {
1524
1525
  { key: 'conversation', header: 'CONVO', maxWidth: 24 },
1525
1526
  ], log);
1526
1527
  }
1528
+ /** Human explanation for quiet-hour audit rows; a one-shot may have been re-armed. */
1529
+ function quietHoursAuditExplanation(fire) {
1530
+ const reason = fire.reason || fire.outcome;
1531
+ if (reason !== 'inside_quiet_hours' && reason !== 'initiative_policy_quiet_hours')
1532
+ return null;
1533
+ if (fire.source === 'once') {
1534
+ return {
1535
+ summary: 'One-shot skipped: quiet hours',
1536
+ detail: 'This skipped occurrence will not retry automatically. Check the trigger state; if the one-shot is spent, schedule a new one outside quiet hours.',
1537
+ };
1538
+ }
1539
+ return {
1540
+ summary: 'Skipped: quiet hours',
1541
+ detail: 'Review the trigger and Agent quiet-hours settings before retrying.',
1542
+ };
1543
+ }
1527
1544
  function renderFireAudit(fires, log) {
1528
1545
  if (fires.length === 0) {
1529
1546
  log('No fire audit records.');
@@ -1536,7 +1553,7 @@ function renderFireAudit(fires, log) {
1536
1553
  source: fire.source ?? '-',
1537
1554
  reason: fire.metadata?.recordKind === 'schedule_end_marker'
1538
1555
  ? 'Schedule ended after prior fire'
1539
- : fire.reason ?? fire.errorMessage ?? '',
1556
+ : quietHoursAuditExplanation(fire)?.summary ?? fire.reason ?? fire.errorMessage ?? '',
1540
1557
  duration: fire.durationMs === undefined ? '-' : `${fire.durationMs}ms`,
1541
1558
  replay: fire.metadata?.replayable === true || fire.metadata?.replayContext
1542
1559
  ? 'yes'