@skrr-ai/cli 0.1.137 → 0.1.140

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.
@@ -1826,7 +1826,10 @@ class BaseCommand extends core_1.Command {
1826
1826
  e.message.includes('ECONNREFUSED') ||
1827
1827
  e.message.includes('fetch failed')) {
1828
1828
  this.failWithCliError({
1829
- message: say(`Could not connect to ${this.cliConfig.baseURL}. Is the API server running?`),
1829
+ message: say(e.code === 'ECONNREFUSED' || e.message.includes('ECONNREFUSED')
1830
+ ? `Could not connect to ${this.cliConfig.baseURL}. Is the API server running?`
1831
+ : `The request to ${this.cliConfig.baseURL} failed before its outcome could be confirmed. ` +
1832
+ 'It may have reached the server. Check the result before retrying.'),
1830
1833
  code: e.code || 'NETWORK_ERROR',
1831
1834
  exit: 5,
1832
1835
  retryable: true,
@@ -73,6 +73,17 @@ export type CanonicalIntentEnvelope = {
73
73
  * a compromised producer cannot elevate itself into a session principal.
74
74
  */
75
75
  export default class AgentMessageSend extends BaseCommand {
76
+ private attemptedMessageKey?;
77
+ private partialSequence?;
78
+ protected failWithCliError(input: {
79
+ message: string;
80
+ code: string;
81
+ status?: number;
82
+ exit: number;
83
+ retryable: boolean;
84
+ details?: unknown;
85
+ requestId?: string;
86
+ }): never;
76
87
  static description: string;
77
88
  static examples: string[];
78
89
  static args: {
@@ -153,6 +164,9 @@ export declare function messageSegmentationAdvisory({ destination, text, followi
153
164
  * from one explicit semantic idempotency key.
154
165
  */
155
166
  export declare function buildSequencedRequests(request: CanonicalMessageIntentRequest, followingParts: string[], hasExplicitIdempotencyKey: boolean): CanonicalMessageIntentRequest[];
167
+ /** A final held or failed part still leaves the requested sequence incomplete,
168
+ * even though there are no later parts for sequenceHalt to withhold. */
169
+ export declare function sequenceComplete(envelopes: readonly CanonicalIntentEnvelope[], halt: SequenceHalt | undefined): boolean;
156
170
  /**
157
171
  * Exit codes for a submitted-but-undelivered message.
158
172
  *
@@ -177,12 +191,14 @@ export declare const EXIT_DELIVERY_FAILED = 4;
177
191
  */
178
192
  export declare function deliveryExitCode(envelopes: readonly CanonicalIntentEnvelope[]): number;
179
193
  export type SequenceHalt = {
180
- /** Parts actually submitted, including the one that halted the sequence. */
194
+ /** Parts submitted, including the one that halted the sequence. */
181
195
  sentParts: number;
182
196
  /** Parts the caller asked for but that were deliberately never submitted. */
183
197
  unsentParts: number;
184
198
  status: CanonicalIntentEnvelope['intent']['status'];
185
199
  reason?: string;
200
+ /** The submitted part was stopped before delivery, rather than delivered. */
201
+ currentPartWithheld?: boolean;
186
202
  };
187
203
  /**
188
204
  * 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;
@@ -74,6 +75,40 @@ const PROTOCOL_VERSION = 1;
74
75
  * a compromised producer cannot elevate itself into a session principal.
75
76
  */
76
77
  class AgentMessageSend extends base_command_1.BaseCommand {
78
+ attemptedMessageKey;
79
+ partialSequence;
80
+ failWithCliError(input) {
81
+ const partial = this.partialSequence;
82
+ const retry = this.attemptedMessageKey && input.exit === 5 && input.retryable && !input.status
83
+ ? {
84
+ idempotencyKey: partial?.sequenceId || this.attemptedMessageKey,
85
+ ...(partial ? { attemptedPartKey: this.attemptedMessageKey } : {}),
86
+ }
87
+ : undefined;
88
+ if (!partial && !retry)
89
+ return super.failWithCliError(input);
90
+ const originalDetails = input.details;
91
+ const extra = { ...(partial ? { partialSequence: partial } : {}), ...(retry ? { messageRetry: retry } : {}) };
92
+ const details = originalDetails && typeof originalDetails === 'object' && !Array.isArray(originalDetails)
93
+ ? {
94
+ ...originalDetails,
95
+ ...(Object.keys(extra).some((key) => Object.hasOwn(originalDetails, key)) ? { originalDetails } : {}),
96
+ ...extra,
97
+ }
98
+ : { ...(originalDetails === undefined ? {} : { originalDetails }), ...extra };
99
+ const outcomes = partial?.parts.map((part, index) => `${index + 1}: ${part.intent.status}`).join(', ');
100
+ const sequenceNote = partial ? `\nEarlier part outcomes: ${outcomes || 'none'}. ` +
101
+ `Part ${partial.attemptedPart} was attempted; ${partial.unattemptedParts} later part(s) were not sent.` : '';
102
+ const json = this.wantsJsonOutput();
103
+ if (retry && !json) {
104
+ // oclif wraps error text and inserts prefixes into long generated keys.
105
+ // Write the key as a single stderr line so it remains copyable.
106
+ process.stderr.write(`Retry idempotency key: ${retry.idempotencyKey}\n`);
107
+ }
108
+ const retryNote = retry ? '\nIf you retry the same message, reuse the retry key shown above.' : '';
109
+ const message = json ? input.message : input.message + sequenceNote + retryNote;
110
+ return super.failWithCliError({ ...input, message, details });
111
+ }
77
112
  static description = 'Submit a channel-neutral agent message intent through the ProactiveMessageGateway';
78
113
  static examples = [
79
114
  '<%= config.bin %> agent message send --from-json payload.json --json',
@@ -313,6 +348,14 @@ class AgentMessageSend extends base_command_1.BaseCommand {
313
348
  const envelopes = [];
314
349
  let halt;
315
350
  for (const [index, requestPart] of requests.entries()) {
351
+ this.attemptedMessageKey = requestPart.idempotencyKey;
352
+ this.partialSequence = requests.length > 1 ? {
353
+ sequenceId: idempotencyKey,
354
+ parts: [...envelopes],
355
+ attemptedPart: index + 1,
356
+ totalParts: requests.length,
357
+ unattemptedParts: requests.length - index - 1,
358
+ } : undefined;
316
359
  const envelope = sessionContext
317
360
  ? await this.submitAsSession({
318
361
  sessionContext,
@@ -325,6 +368,8 @@ class AgentMessageSend extends base_command_1.BaseCommand {
325
368
  agentIdentity: agentIdentity,
326
369
  principalSource,
327
370
  });
371
+ this.partialSequence = undefined;
372
+ this.attemptedMessageKey = undefined;
328
373
  envelopes.push(envelope);
329
374
  // A part that did not reach the user must stop the sequence. Continuing
330
375
  // would deliver thought 3 while thought 2 sits held for approval, and the
@@ -342,7 +387,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
342
387
  this.log(JSON.stringify(requests.length === 1
343
388
  ? envelopes[0]
344
389
  : {
345
- ok: envelopes.every((envelope) => envelope.ok) && !halt,
390
+ ok: sequenceComplete(envelopes, halt),
346
391
  sequenceId: idempotencyKey,
347
392
  parts: envelopes,
348
393
  ...(halt ? { halt } : {}),
@@ -616,6 +661,11 @@ const SEQUENCE_CONTINUING_STATUSES = new Set([
616
661
  'duplicate',
617
662
  'queued_offline',
618
663
  ]);
664
+ /** A final held or failed part still leaves the requested sequence incomplete,
665
+ * even though there are no later parts for sequenceHalt to withhold. */
666
+ function sequenceComplete(envelopes, halt) {
667
+ return !halt && envelopes.every((envelope) => envelope.ok && SEQUENCE_CONTINUING_STATUSES.has(envelope.intent.status));
668
+ }
619
669
  /**
620
670
  * Statuses that mean the message will never reach the user without a new send.
621
671
  *
@@ -672,18 +722,20 @@ function deliveryExitCode(envelopes) {
672
722
  * left to withhold and reporting a halt would be noise.
673
723
  */
674
724
  function sequenceHalt({ envelope, sentCount, totalParts, }) {
675
- if (totalParts < 2 || sentCount >= totalParts)
725
+ const currentPartWithheld = envelope.intent.status === 'dropped' && envelope.intent.reason === 'owner_replied';
726
+ if (totalParts < 2 || (sentCount >= totalParts && !currentPartWithheld))
676
727
  return undefined;
677
728
  // The owner replying mid-update is a halt for the same reason a failed
678
729
  // delivery is: the remaining parts would land after their turn, so the
679
730
  // thought arrives split around something the agent has not read yet.
680
731
  // Delivery of the part that reported it still SUCCEEDED.
681
- if (envelope.intent.ownerInterjected) {
732
+ if (envelope.intent.ownerInterjected || currentPartWithheld) {
682
733
  return {
683
734
  sentParts: sentCount,
684
735
  unsentParts: totalParts - sentCount,
685
736
  status: envelope.intent.status,
686
737
  reason: 'owner_replied',
738
+ ...(currentPartWithheld ? { currentPartWithheld: true } : {}),
687
739
  };
688
740
  }
689
741
  if (envelope.ok && SEQUENCE_CONTINUING_STATUSES.has(envelope.intent.status))
@@ -697,6 +749,10 @@ function sequenceHalt({ envelope, sentCount, totalParts, }) {
697
749
  }
698
750
  function formatHalt(halt) {
699
751
  if (halt.reason === 'owner_replied') {
752
+ if (halt.currentPartWithheld) {
753
+ return (`Stopped before delivering part ${halt.sentParts}: the user replied while you were still sending. ` +
754
+ `This part and ${halt.unsentParts} later part(s) were not delivered. Read what they said before continuing.`);
755
+ }
700
756
  return (`Stopped after part ${halt.sentParts}: the user replied while you were still sending. ` +
701
757
  `${halt.unsentParts} later part(s) were not sent. Read what they said before continuing — ` +
702
758
  'the rest of your update may no longer be the right thing to say.');
@@ -288,7 +288,9 @@ class AgentsCreate extends base_command_1.BaseCommand {
288
288
  'support-contact': core_1.Flags.string({
289
289
  description: 'Support contact JSON object: {"name","email","security_email"}. The Store listing shows the email and security_email of the published release.',
290
290
  }),
291
- 'install-first-contact': core_1.Flags.string({ description: 'First-contact config JSON value' }),
291
+ 'install-first-contact': core_1.Flags.string({
292
+ description: 'First-contact config JSON value; notificationPolicy is normal or silent (legacy quiet is also accepted)',
293
+ }),
292
294
  'end-after-tools': core_1.Flags.boolean({ description: 'End turn after tools' }),
293
295
  'hide-sequential-outputs': core_1.Flags.boolean({ description: 'Hide sequential outputs' }),
294
296
  'is-collaborative': core_1.Flags.boolean({ description: 'Enable collaboration' }),
@@ -53,6 +53,21 @@ function proactiveInstallReadiness(result, bin) {
53
53
  if (result.warnings.length === 0) {
54
54
  return { status: 'ready', message: 'All requested setup steps completed.' };
55
55
  }
56
+ if (result.warnings.some((warning) => warning.step.startsWith('commitment.'))) {
57
+ const affected = (result.installed.commitments || []).filter((commitment) => commitment.status !== 'active' || result.warnings.some((warning) => warning.step === `commitment.${commitment.title}`));
58
+ const ids = [...new Set(affected.map((commitment) => commitment.id))]
59
+ .filter((id) => typeof id === 'string' && /^[A-Za-z0-9_-]+$/.test(id));
60
+ const safeAgentId = /^[A-Za-z0-9_-]+$/.test(result.agentId) ? result.agentId : null;
61
+ return {
62
+ status: 'degraded',
63
+ message: ids.length
64
+ ? `Review the existing Commitment${ids.length === 1 ? '' : 's'} ${ids.join(', ')} and resolve the reported issues. Review any other setup warnings as well.`
65
+ : 'A requested Commitment needs attention. Review the setup warnings and inspect the Agent’s existing Commitments before deciding what to do next.',
66
+ ...(ids.length === 1
67
+ ? { repairCommand: `${bin} commitments preflight ${ids[0]}` }
68
+ : safeAgentId ? { repairCommand: `${bin} commitments list --agent ${safeAgentId}` } : {}),
69
+ };
70
+ }
56
71
  if (result.warnings.some((warning) => warning.code === 'always_on_off')) {
57
72
  return {
58
73
  status: 'degraded',
@@ -84,10 +99,11 @@ function proactiveInstallReadiness(result, bin) {
84
99
  };
85
100
  }
86
101
  const repairCommand = `${bin} agents spawn --agent-id ${result.agentId} --from-spec <spec.json> --approve`;
102
+ const watcherFailed = result.warnings.some((warning) => warning.step.startsWith('watcher.'));
87
103
  return {
88
104
  status: 'degraded',
89
- message: 'The Agent was created, but one or more requested setup steps did not install. ' +
90
- 'Do not assume failed watchers are active until their warning is resolved and the install is re-run.',
105
+ message: 'Some requested setup steps need attention. Review the warnings.' +
106
+ (watcherFailed ? ' Do not assume failed watchers are active.' : ''),
91
107
  repairCommand,
92
108
  };
93
109
  }
@@ -113,8 +129,8 @@ class AgentsSpawn extends base_command_1.BaseCommand {
113
129
  '<%= config.bin %> agents spawn "plan my day every morning, working hours 9-6" --approve',
114
130
  '<%= config.bin %> agents spawn "ping me when a PR needs review" --json',
115
131
  '<%= 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',
132
+ '<%= config.bin %> agents spawn --approve-recommendation par_123 --spec-hash <reviewed-hash>',
133
+ '<%= config.bin %> agents spawn --apply-recommendation par_123 --spec-hash <reviewed-hash>',
118
134
  '<%= config.bin %> agents spawn --from-spec spec.json --approve',
119
135
  ];
120
136
  static args = {
@@ -129,19 +145,19 @@ class AgentsSpawn extends base_command_1.BaseCommand {
129
145
  description: 'Create the agent and install the proactive system(s) (otherwise plan-only)',
130
146
  }),
131
147
  recommend: core_1.Flags.boolean({
132
- description: 'Persist a reviewable recommendation instead of creating directly',
148
+ description: 'Persist a reviewable recommendation from a sentence (cannot be combined with --from-spec)',
133
149
  }),
134
150
  'approve-recommendation': core_1.Flags.string({
135
151
  description: 'Approve an existing proactive-agent recommendation id',
136
152
  }),
137
153
  'apply-recommendation': core_1.Flags.string({
138
- description: 'Apply an already-approved proactive-agent recommendation id',
154
+ description: 'Apply an already-approved proactive-agent recommendation id (requires --spec-hash)',
139
155
  }),
140
156
  'spec-hash': core_1.Flags.string({
141
- description: 'Expected recommendation spec hash for approval/apply proof',
157
+ description: 'Hash from the reviewed recommendation (required for apply; optional for approval)',
142
158
  }),
143
159
  'from-spec': core_1.Flags.string({
144
- description: 'Path to a spec JSON (or "-" for stdin) to apply directly (requires --approve)',
160
+ description: 'Path to a spec JSON (or "-" for stdin) to apply directly (requires --approve). An explicit empty systems list skips implicit baseline watchers.',
145
161
  }),
146
162
  'agent-id': core_1.Flags.string({
147
163
  description: 'Apply onto an existing agent instead of creating a new one (convergent re-run)',
@@ -158,6 +174,9 @@ class AgentsSpawn extends base_command_1.BaseCommand {
158
174
  async run() {
159
175
  this.requireAuth();
160
176
  const { args, flags } = await this.parse(AgentsSpawn);
177
+ if (flags.recommend && flags['from-spec']) {
178
+ 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 });
179
+ }
161
180
  try {
162
181
  if (flags['approve-recommendation'] || flags['apply-recommendation']) {
163
182
  await this.runRecommendationAction(flags);
@@ -197,7 +216,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
197
216
  ...(flags.timezone ? { timezone: flags.timezone } : {}),
198
217
  fromReviewedSpec: true,
199
218
  });
200
- this.renderApplyResult(result, flags.json);
219
+ this.renderApplyResult(result, flags.json, Boolean(flags['agent-id']));
201
220
  }
202
221
  async runFromSentence(sentence, flags) {
203
222
  const history = (flags.message ?? []).map((content) => ({
@@ -256,9 +275,14 @@ class AgentsSpawn extends base_command_1.BaseCommand {
256
275
  ...(flags.timezone ? { timezone: flags.timezone } : {}),
257
276
  fromReviewedSpec: false,
258
277
  });
259
- this.renderApplyResult(result, flags.json);
278
+ this.renderApplyResult(result, flags.json, Boolean(flags['agent-id']));
260
279
  }
261
280
  async runRecommendationAction(flags) {
281
+ if (flags['apply-recommendation'] && !flags['spec-hash']?.trim()) {
282
+ this.error(`Applying a recommendation requires --spec-hash <reviewed-hash>. ` +
283
+ 'Use the Spec hash from the recommendation preview or recommendation.specHash from the approval JSON. ' +
284
+ `Run: ${this.config.bin} agents spawn --apply-recommendation ${flags['apply-recommendation']} --spec-hash <reviewed-hash>`, { exit: 1 });
285
+ }
262
286
  let approved = null;
263
287
  if (flags['approve-recommendation']) {
264
288
  approved = await proactiveApi_1.proactiveApi.approveProactiveAgentRecommendation(flags['approve-recommendation'], flags['spec-hash'] ? { specHash: flags['spec-hash'] } : undefined);
@@ -268,7 +292,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
268
292
  return;
269
293
  }
270
294
  this.log(`Approved recommendation ${approved.recommendation.id}`);
271
- this.log(`Apply it: ${this.config.bin} agents spawn --apply-recommendation ${approved.recommendation.id}`);
295
+ this.log(`Apply it: ${this.config.bin} agents spawn --apply-recommendation ${approved.recommendation.id} --spec-hash ${approved.recommendation.specHash}`);
272
296
  return;
273
297
  }
274
298
  }
@@ -281,7 +305,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
281
305
  ...(flags.timezone ? { timezone: flags.timezone } : {}),
282
306
  ...(flags['spec-hash'] ? { specHash: flags['spec-hash'] } : {}),
283
307
  });
284
- this.renderApplyResult(result, flags.json);
308
+ this.renderApplyResult(result, flags.json, Boolean(flags['agent-id']));
285
309
  }
286
310
  renderSpec(spec) {
287
311
  const id = spec.identity;
@@ -309,8 +333,13 @@ class AgentsSpawn extends base_command_1.BaseCommand {
309
333
  `hours: ${o.workingHours.start}–${o.workingHours.end}` +
310
334
  `${o.workingHours.timezone ? ` ${o.workingHours.timezone}` : ''}`);
311
335
  }
336
+ if (Array.isArray(spec.commitments) && spec.commitments.length > 0) {
337
+ this.log('');
338
+ this.log('Commitments (as provided; subject to validation):');
339
+ this.log(JSON.stringify(spec.commitments, null, 2));
340
+ }
312
341
  }
313
- renderApplyResult(result, json) {
342
+ renderApplyResult(result, json, existingAgent) {
314
343
  const readiness = proactiveInstallReadiness(result, this.config.bin);
315
344
  if (json) {
316
345
  this.log(JSON.stringify({
@@ -320,7 +349,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
320
349
  }, null, 2));
321
350
  return;
322
351
  }
323
- this.log(`Spawned agent ${result.agentId}`);
352
+ this.log(`${existingAgent ? 'Existing agent' : 'Spawned agent'} ${result.agentId}`);
324
353
  this.log(`URL: ${(0, web_url_1.agentUrlFrom)(this.cliConfig.baseURL, { id: result.agentId }) ?? '-'}`);
325
354
  this.log(`Status: ${readiness.status.toUpperCase()} — ${readiness.message}`);
326
355
  const w = result.installed.worker;
@@ -1,6 +1,6 @@
1
1
  import { BaseCommand } from '../../../base-command';
2
2
  /**
3
- * `skrr commitments endpoints list` — the delivery targets commitments may report to.
3
+ * `skrr commitments endpoints list --agent <id>` — delivery targets for an Agent.
4
4
  *
5
5
  * The `USABLE` column is the one that matters: it is the field the commitment
6
6
  * invocation actually reads when deciding whether a report target can be used.
@@ -12,7 +12,7 @@ export default class CommitmentsEndpointsList extends BaseCommand {
12
12
  static examples: string[];
13
13
  static flags: {
14
14
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
- agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ agent: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
16
16
  };
17
17
  run(): Promise<void>;
18
18
  }
@@ -5,7 +5,7 @@ const core_1 = require("@oclif/core");
5
5
  const base_command_1 = require("../../../base-command");
6
6
  const commitment_endpoints_1 = require("../../../lib/commitment-endpoints");
7
7
  /**
8
- * `skrr commitments endpoints list` — the delivery targets commitments may report to.
8
+ * `skrr commitments endpoints list --agent <id>` — delivery targets for an Agent.
9
9
  *
10
10
  * The `USABLE` column is the one that matters: it is the field the commitment
11
11
  * invocation actually reads when deciding whether a report target can be used.
@@ -15,12 +15,12 @@ const commitment_endpoints_1 = require("../../../lib/commitment-endpoints");
15
15
  class CommitmentsEndpointsList extends base_command_1.BaseCommand {
16
16
  static description = 'List commitment delivery endpoints';
17
17
  static examples = [
18
- '<%= config.bin %> commitments endpoints list',
18
+ '<%= config.bin %> commitments endpoints list --agent agent_abc',
19
19
  '<%= config.bin %> commitments endpoints list --agent agent_abc --json',
20
20
  ];
21
21
  static flags = {
22
22
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
23
- agent: core_1.Flags.string({ description: 'Filter by agent ID' }),
23
+ agent: core_1.Flags.string({ description: 'Agent ID whose delivery endpoints to list', required: true }),
24
24
  };
25
25
  async run() {
26
26
  this.requireAuth();
@@ -197,6 +197,25 @@ class StoreInstall extends base_command_1.BaseCommand {
197
197
  }
198
198
  const installedId = response?.installedAgentId;
199
199
  this.log(`Installed as ${installedId ?? '-'}.`);
200
+ if (response?.proactive?.armed === false) {
201
+ this.log('This Agent starts in standby (Always-On is off).');
202
+ if (response.proactive.enable?.cli) {
203
+ this.log(`To let it work on its own: ${response.proactive.enable.cli}`);
204
+ }
205
+ }
206
+ const firstContact = response?.installFirstContact;
207
+ if (firstContact?.scheduled === true) {
208
+ const rawRunAt = firstContact.runAt ?? firstContact.scheduledFor;
209
+ const date = rawRunAt instanceof Date ? rawRunAt : rawRunAt ? new Date(rawRunAt) : undefined;
210
+ const when = date && Number.isFinite(date.getTime()) ? ` for ${date.toISOString()}` : '';
211
+ this.log(`A one-time first-contact greeting is scheduled${when}.`);
212
+ }
213
+ else if (firstContact?.duplicate === true || firstContact?.reason === 'already_scheduled') {
214
+ this.log('A first-contact trigger already exists; check its status to see whether it is still pending.');
215
+ }
216
+ else if (firstContact?.scheduled === false) {
217
+ this.log('No first-contact greeting was scheduled by this install.');
218
+ }
200
219
  // Report only what the server says it wrote. A server that does not echo a
201
220
  // placement predates it and wrote none, so naming one here would be a claim
202
221
  // about a copy this CLI cannot see.
@@ -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)
@@ -48,6 +48,7 @@ export interface ProactiveAgentSpec {
48
48
  mode: OrchestratorMode;
49
49
  executePlan: boolean;
50
50
  };
51
+ commitments?: Array<Record<string, unknown>>;
51
52
  initialize?: {
52
53
  goals?: Array<{
53
54
  title: string;
@@ -121,6 +122,16 @@ export interface ApplyProactiveAgentResponse {
121
122
  status?: string;
122
123
  code?: string;
123
124
  };
125
+ commitments?: Array<{
126
+ id: string;
127
+ title?: string;
128
+ status?: string;
129
+ activated?: boolean;
130
+ blockedBy?: Array<{
131
+ gate?: string;
132
+ reason?: string;
133
+ }>;
134
+ }>;
124
135
  initialize?: {
125
136
  goals: Array<{
126
137
  id?: 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
@@ -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'