@skrr-ai/cli 0.1.136 → 0.1.139

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.
@@ -153,6 +153,9 @@ export declare function messageSegmentationAdvisory({ destination, text, followi
153
153
  * from one explicit semantic idempotency key.
154
154
  */
155
155
  export declare function buildSequencedRequests(request: CanonicalMessageIntentRequest, followingParts: string[], hasExplicitIdempotencyKey: boolean): CanonicalMessageIntentRequest[];
156
+ /** A final held or failed part still leaves the requested sequence incomplete,
157
+ * even though there are no later parts for sequenceHalt to withhold. */
158
+ export declare function sequenceComplete(envelopes: readonly CanonicalIntentEnvelope[], halt: SequenceHalt | undefined): boolean;
156
159
  /**
157
160
  * Exit codes for a submitted-but-undelivered message.
158
161
  *
@@ -177,12 +180,14 @@ export declare const EXIT_DELIVERY_FAILED = 4;
177
180
  */
178
181
  export declare function deliveryExitCode(envelopes: readonly CanonicalIntentEnvelope[]): number;
179
182
  export type SequenceHalt = {
180
- /** Parts actually submitted, including the one that halted the sequence. */
183
+ /** Parts submitted, including the one that halted the sequence. */
181
184
  sentParts: number;
182
185
  /** Parts the caller asked for but that were deliberately never submitted. */
183
186
  unsentParts: number;
184
187
  status: CanonicalIntentEnvelope['intent']['status'];
185
188
  reason?: string;
189
+ /** The submitted part was stopped before delivery, rather than delivered. */
190
+ currentPartWithheld?: boolean;
186
191
  };
187
192
  /**
188
193
  * Decide whether a sequence stops after this part. Returns `undefined` when the
@@ -37,6 +37,7 @@ exports.EXIT_DELIVERY_FAILED = exports.EXIT_DELIVERY_RETRYABLE = exports.OWNER_D
37
37
  exports.withSendWaitNotice = withSendWaitNotice;
38
38
  exports.messageSegmentationAdvisory = messageSegmentationAdvisory;
39
39
  exports.buildSequencedRequests = buildSequencedRequests;
40
+ exports.sequenceComplete = sequenceComplete;
40
41
  exports.deliveryExitCode = deliveryExitCode;
41
42
  exports.sequenceHalt = sequenceHalt;
42
43
  exports.rejectPrincipalOverrides = rejectPrincipalOverrides;
@@ -342,7 +343,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
342
343
  this.log(JSON.stringify(requests.length === 1
343
344
  ? envelopes[0]
344
345
  : {
345
- ok: envelopes.every((envelope) => envelope.ok) && !halt,
346
+ ok: sequenceComplete(envelopes, halt),
346
347
  sequenceId: idempotencyKey,
347
348
  parts: envelopes,
348
349
  ...(halt ? { halt } : {}),
@@ -616,6 +617,11 @@ const SEQUENCE_CONTINUING_STATUSES = new Set([
616
617
  'duplicate',
617
618
  'queued_offline',
618
619
  ]);
620
+ /** A final held or failed part still leaves the requested sequence incomplete,
621
+ * even though there are no later parts for sequenceHalt to withhold. */
622
+ function sequenceComplete(envelopes, halt) {
623
+ return !halt && envelopes.every((envelope) => envelope.ok && SEQUENCE_CONTINUING_STATUSES.has(envelope.intent.status));
624
+ }
619
625
  /**
620
626
  * Statuses that mean the message will never reach the user without a new send.
621
627
  *
@@ -672,18 +678,20 @@ function deliveryExitCode(envelopes) {
672
678
  * left to withhold and reporting a halt would be noise.
673
679
  */
674
680
  function sequenceHalt({ envelope, sentCount, totalParts, }) {
675
- if (totalParts < 2 || sentCount >= totalParts)
681
+ const currentPartWithheld = envelope.intent.status === 'dropped' && envelope.intent.reason === 'owner_replied';
682
+ if (totalParts < 2 || (sentCount >= totalParts && !currentPartWithheld))
676
683
  return undefined;
677
684
  // The owner replying mid-update is a halt for the same reason a failed
678
685
  // delivery is: the remaining parts would land after their turn, so the
679
686
  // thought arrives split around something the agent has not read yet.
680
687
  // Delivery of the part that reported it still SUCCEEDED.
681
- if (envelope.intent.ownerInterjected) {
688
+ if (envelope.intent.ownerInterjected || currentPartWithheld) {
682
689
  return {
683
690
  sentParts: sentCount,
684
691
  unsentParts: totalParts - sentCount,
685
692
  status: envelope.intent.status,
686
693
  reason: 'owner_replied',
694
+ ...(currentPartWithheld ? { currentPartWithheld: true } : {}),
687
695
  };
688
696
  }
689
697
  if (envelope.ok && SEQUENCE_CONTINUING_STATUSES.has(envelope.intent.status))
@@ -697,6 +705,10 @@ function sequenceHalt({ envelope, sentCount, totalParts, }) {
697
705
  }
698
706
  function formatHalt(halt) {
699
707
  if (halt.reason === 'owner_replied') {
708
+ if (halt.currentPartWithheld) {
709
+ return (`Stopped before delivering part ${halt.sentParts}: the user replied while you were still sending. ` +
710
+ `This part and ${halt.unsentParts} later part(s) were not delivered. Read what they said before continuing.`);
711
+ }
700
712
  return (`Stopped after part ${halt.sentParts}: the user replied while you were still sending. ` +
701
713
  `${halt.unsentParts} later part(s) were not sent. Read what they said before continuing — ` +
702
714
  'the rest of your update may no longer be the right thing to say.');
@@ -113,8 +113,8 @@ class AgentsSpawn extends base_command_1.BaseCommand {
113
113
  '<%= config.bin %> agents spawn "plan my day every morning, working hours 9-6" --approve',
114
114
  '<%= config.bin %> agents spawn "ping me when a PR needs review" --json',
115
115
  '<%= config.bin %> agents spawn "watch launch blockers" --recommend',
116
- '<%= config.bin %> agents spawn --approve-recommendation par_123',
117
- '<%= config.bin %> agents spawn --apply-recommendation par_123',
116
+ '<%= config.bin %> agents spawn --approve-recommendation par_123 --spec-hash <reviewed-hash>',
117
+ '<%= config.bin %> agents spawn --apply-recommendation par_123 --spec-hash <reviewed-hash>',
118
118
  '<%= config.bin %> agents spawn --from-spec spec.json --approve',
119
119
  ];
120
120
  static args = {
@@ -135,13 +135,13 @@ class AgentsSpawn extends base_command_1.BaseCommand {
135
135
  description: 'Approve an existing proactive-agent recommendation id',
136
136
  }),
137
137
  'apply-recommendation': core_1.Flags.string({
138
- description: 'Apply an already-approved proactive-agent recommendation id',
138
+ description: 'Apply an already-approved proactive-agent recommendation id (requires --spec-hash)',
139
139
  }),
140
140
  'spec-hash': core_1.Flags.string({
141
- description: 'Expected recommendation spec hash for approval/apply proof',
141
+ description: 'Hash from the reviewed recommendation (required for apply; optional for approval)',
142
142
  }),
143
143
  'from-spec': core_1.Flags.string({
144
- description: 'Path to a spec JSON (or "-" for stdin) to apply directly (requires --approve)',
144
+ description: 'Path to a spec JSON (or "-" for stdin) to apply directly (requires --approve). An explicit empty systems list skips implicit baseline watchers.',
145
145
  }),
146
146
  'agent-id': core_1.Flags.string({
147
147
  description: 'Apply onto an existing agent instead of creating a new one (convergent re-run)',
@@ -259,6 +259,11 @@ class AgentsSpawn extends base_command_1.BaseCommand {
259
259
  this.renderApplyResult(result, flags.json);
260
260
  }
261
261
  async runRecommendationAction(flags) {
262
+ if (flags['apply-recommendation'] && !flags['spec-hash']?.trim()) {
263
+ this.error(`Applying a recommendation requires --spec-hash <reviewed-hash>. ` +
264
+ 'Use the Spec hash from the recommendation preview or recommendation.specHash from the approval JSON. ' +
265
+ `Run: ${this.config.bin} agents spawn --apply-recommendation ${flags['apply-recommendation']} --spec-hash <reviewed-hash>`, { exit: 1 });
266
+ }
262
267
  let approved = null;
263
268
  if (flags['approve-recommendation']) {
264
269
  approved = await proactiveApi_1.proactiveApi.approveProactiveAgentRecommendation(flags['approve-recommendation'], flags['spec-hash'] ? { specHash: flags['spec-hash'] } : undefined);
@@ -268,7 +273,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
268
273
  return;
269
274
  }
270
275
  this.log(`Approved recommendation ${approved.recommendation.id}`);
271
- this.log(`Apply it: ${this.config.bin} agents spawn --apply-recommendation ${approved.recommendation.id}`);
276
+ this.log(`Apply it: ${this.config.bin} agents spawn --apply-recommendation ${approved.recommendation.id} --spec-hash ${approved.recommendation.specHash}`);
272
277
  return;
273
278
  }
274
279
  }
@@ -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, {
@@ -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
  });
@@ -29,6 +29,10 @@ function describeFireAuditDetail(detail, fireId, triggerId) {
29
29
  if (quietHours) {
30
30
  lines.push(`Explanation: ${quietHours.summary}. ${quietHours.detail}`);
31
31
  }
32
+ const policy = (0, triggers_1.policyAuditExplanation)(detail);
33
+ if (policy) {
34
+ lines.push(`Explanation: ${policy.summary}. ${policy.detail}`);
35
+ }
32
36
  if (detail.durationMs !== undefined)
33
37
  lines.push(`Duration: ${String(detail.durationMs)}ms`);
34
38
  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;
@@ -592,6 +592,13 @@ export declare function quietHoursAuditExplanation(fire: {
592
592
  summary: string;
593
593
  detail: string;
594
594
  } | null;
595
+ export declare function policyAuditExplanation(fire: {
596
+ outcome?: unknown;
597
+ reason?: unknown;
598
+ }): {
599
+ summary: string;
600
+ detail: string;
601
+ } | null;
595
602
  export declare function renderFireAudit(fires: TriggerFireRecord[], log: (line: string) => void): void;
596
603
  /**
597
604
  * Trigger budget for one scope. `active` counts only ENABLED rows — a disabled
@@ -608,6 +615,9 @@ export interface TriggerQuotaStatus {
608
615
  perUser: number;
609
616
  perUserLimit: number;
610
617
  perUserRemaining: number;
618
+ /** Workspace used by the admission counter; null means the unscoped counter. */
619
+ counterWorkspaceId?: string | null;
620
+ reclaimableScope?: 'owner_all_workspaces';
611
621
  /**
612
622
  * Disabled rows across EVERY scope this user owns. `reclaimable` above is
613
623
  * scoped, which cannot size the remedy for a per-user refusal — that cap
@@ -54,6 +54,7 @@ exports.fireRefusalLines = fireRefusalLines;
54
54
  exports.renderTriggerSummary = renderTriggerSummary;
55
55
  exports.renderLegacyRuns = renderLegacyRuns;
56
56
  exports.quietHoursAuditExplanation = quietHoursAuditExplanation;
57
+ exports.policyAuditExplanation = policyAuditExplanation;
57
58
  exports.renderFireAudit = renderFireAudit;
58
59
  const data_provider_1 = require("@skrr-ai/data-provider");
59
60
  const node_fs_1 = require("node:fs");
@@ -1541,6 +1542,14 @@ function quietHoursAuditExplanation(fire) {
1541
1542
  detail: 'Review the trigger and Agent quiet-hours settings before retrying.',
1542
1543
  };
1543
1544
  }
1545
+ function policyAuditExplanation(fire) {
1546
+ if (fire.outcome !== 'skipped' || fire.reason !== 'initiative_policy_suggestions_only')
1547
+ return null;
1548
+ return {
1549
+ summary: 'Skipped: suggestions-only policy',
1550
+ detail: 'The Agent policy prevented autonomous execution. Review the trigger preflight and Agent policy; an inbox suggestion is not guaranteed.',
1551
+ };
1552
+ }
1544
1553
  function renderFireAudit(fires, log) {
1545
1554
  if (fires.length === 0) {
1546
1555
  log('No fire audit records.');
@@ -1553,7 +1562,7 @@ function renderFireAudit(fires, log) {
1553
1562
  source: fire.source ?? '-',
1554
1563
  reason: fire.metadata?.recordKind === 'schedule_end_marker'
1555
1564
  ? 'Schedule ended after prior fire'
1556
- : quietHoursAuditExplanation(fire)?.summary ?? fire.reason ?? fire.errorMessage ?? '',
1565
+ : quietHoursAuditExplanation(fire)?.summary ?? policyAuditExplanation(fire)?.summary ?? fire.reason ?? fire.errorMessage ?? '',
1557
1566
  duration: fire.durationMs === undefined ? '-' : `${fire.durationMs}ms`,
1558
1567
  replay: fire.metadata?.replayable === true || fire.metadata?.replayContext
1559
1568
  ? 'yes'