@skrr-ai/cli 0.1.140 → 0.1.141

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.
@@ -36,11 +36,32 @@ class AgentsAlwaysOnStatus extends base_command_1.BaseCommand {
36
36
  catch (err) {
37
37
  this.handleApiError(err);
38
38
  }
39
+ // This endpoint authorizes and resolves by Agent ID. Its messaging scope is
40
+ // built from the Agent's own workspace, which can differ from the global
41
+ // workspace header supplied by the caller.
42
+ const resolvedWorkspaceId = status.messaging?.scope?.workspaceId;
43
+ const workspaceSelection = flags.workspace
44
+ ? {
45
+ requestedWorkspaceId: flags.workspace,
46
+ resolvedWorkspaceId: resolvedWorkspaceId || null,
47
+ notice: !resolvedWorkspaceId
48
+ ? 'Status was resolved by Agent ID; the Agent workspace could not be confirmed.'
49
+ : resolvedWorkspaceId !== flags.workspace
50
+ ? 'Status was resolved by Agent ID in a different workspace than requested.'
51
+ : null,
52
+ }
53
+ : null;
39
54
  if (flags.json) {
40
- this.log(JSON.stringify(status, null, 2));
55
+ this.log(JSON.stringify(workspaceSelection ? { ...status, workspaceSelection } : status, null, 2));
41
56
  return;
42
57
  }
43
58
  this.log(`Agent: ${args.id}`);
59
+ if (resolvedWorkspaceId)
60
+ this.log(`Agent workspace: ${resolvedWorkspaceId}`);
61
+ if (workspaceSelection?.notice) {
62
+ this.log(`Workspace: ${workspaceSelection.notice}`);
63
+ this.log(`Requested: ${workspaceSelection.requestedWorkspaceId}`);
64
+ }
44
65
  this.log(`Desired: ${status.desiredEnabled ? 'on' : 'off'}`);
45
66
  this.log(`Generation: ${status.generation}`);
46
67
  this.log(`Operational: ${status.operationalState}`);
@@ -57,8 +78,8 @@ class AgentsAlwaysOnStatus extends base_command_1.BaseCommand {
57
78
  }
58
79
  const cr = status.checkRun;
59
80
  this.log(`Checks/Runs: checks=${cr.checks.queued + cr.checks.running}` +
60
- ` runs=${cr.runs.queued + cr.runs.running + cr.runs.waiting}` +
61
- ` (active=${cr.activeTotal})`);
81
+ ` runs=${(cr.runs.deferred ?? 0) + cr.runs.queued + cr.runs.running + cr.runs.waiting}` +
82
+ ` (deferred=${cr.runs.deferred ?? 0}, active=${cr.activeTotal})`);
62
83
  if (status.messaging?.degraded) {
63
84
  const reasons = (status.messaging.degradedReasons || []).join(', ') || 'unknown';
64
85
  this.log(`Messaging: degraded (${reasons})`);
@@ -68,6 +68,12 @@ function proactiveInstallReadiness(result, bin) {
68
68
  : safeAgentId ? { repairCommand: `${bin} commitments list --agent ${safeAgentId}` } : {}),
69
69
  };
70
70
  }
71
+ if (result.warnings.some((warning) => ['job_preserved_disabled', 'job_already_fired', 'job_state_unavailable'].includes(warning.code))) {
72
+ return {
73
+ status: 'degraded',
74
+ message: 'An existing scheduled job needs attention. Review the setup warnings before deciding what to do next.',
75
+ };
76
+ }
71
77
  if (result.warnings.some((warning) => warning.code === 'always_on_off')) {
72
78
  return {
73
79
  status: 'degraded',
@@ -227,6 +233,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
227
233
  const result = await proactiveApi_1.proactiveApi.planProactiveAgentRecommendation({
228
234
  sentence,
229
235
  source: 'manual',
236
+ ...(flags.name ? { name: flags.name } : {}),
230
237
  ...(history.length > 0 ? { history } : {}),
231
238
  ...(flags.timezone ? { timezone: flags.timezone } : {}),
232
239
  });
@@ -246,13 +253,17 @@ class AgentsSpawn extends base_command_1.BaseCommand {
246
253
  if (plan.needsRefinement || !plan.spec) {
247
254
  if (flags.json) {
248
255
  this.log(JSON.stringify(plan, null, 2));
256
+ if (plan.failure)
257
+ this.exit(1);
249
258
  return;
250
259
  }
251
260
  this.log(plan.message);
252
261
  if (plan.droppedWatchers && plan.droppedWatchers.length > 0) {
253
262
  this.log(`(ignored unknown sources: ${plan.droppedWatchers.join(', ')})`);
254
263
  }
255
- this.error('Could not build a complete agent yet — refine the sentence and try again.', {
264
+ this.error(plan.failure
265
+ ? 'Planning could not start. Review the billing guidance above.'
266
+ : 'Could not build a complete agent yet — refine the sentence and try again.', {
256
267
  exit: 1,
257
268
  });
258
269
  }
@@ -360,6 +371,25 @@ class AgentsSpawn extends base_command_1.BaseCommand {
360
371
  const o = result.installed.orchestrator;
361
372
  if (o) {
362
373
  this.log(` orchestrator: ${o.ok ? `installed${o.status ? ` (${o.status})` : ''}` : 'failed'}`);
374
+ if (o.scheduleNotice)
375
+ this.log(` ${o.scheduleNotice}`);
376
+ for (const schedule of o.schedules || []) {
377
+ const state = !schedule.triggerId
378
+ ? 'not scheduled'
379
+ : schedule.enabled === null ? 'unknown' : schedule.enabled ? 'enabled' : 'disabled';
380
+ this.log(` ${schedule.kind}: ${state}` +
381
+ (schedule.triggerId ? ` (${schedule.triggerId})` : '') +
382
+ (schedule.reason ? ` — ${schedule.reason}` : ''));
383
+ }
384
+ if (o.schedules?.some((schedule) => schedule.triggerId)) {
385
+ this.log(` Preflight: ${this.config.bin} triggers preflight <trigger-id>`);
386
+ }
387
+ }
388
+ for (const watcher of result.installed.defaultWatchers || []) {
389
+ if (!watcher.ok)
390
+ continue;
391
+ const state = watcher.enabled == null ? 'unknown' : watcher.enabled ? 'enabled' : 'disabled';
392
+ this.log(` ${watcher.source}: ${state}` + (watcher.triggerId ? ` (${watcher.triggerId})` : ''));
363
393
  }
364
394
  if (result.warnings.length > 0) {
365
395
  this.log(' warnings:');
@@ -377,6 +407,8 @@ class AgentsSpawn extends base_command_1.BaseCommand {
377
407
  renderRecommendationResult(recommendation, plan, json) {
378
408
  if (json) {
379
409
  this.log(JSON.stringify({ plan, recommendation }, null, 2));
410
+ if (plan.failure)
411
+ this.exit(1);
380
412
  return;
381
413
  }
382
414
  if (!recommendation) {
@@ -384,7 +416,9 @@ class AgentsSpawn extends base_command_1.BaseCommand {
384
416
  if (plan.droppedWatchers && plan.droppedWatchers.length > 0) {
385
417
  this.log(`(ignored unknown sources: ${plan.droppedWatchers.join(', ')})`);
386
418
  }
387
- this.error('Recommendation was not created — refine the sentence and try again.', {
419
+ this.error(plan.failure
420
+ ? 'Recommendation was not created because planning could not start. Review the billing guidance above.'
421
+ : 'Recommendation was not created — refine the sentence and try again.', {
388
422
  exit: 1,
389
423
  });
390
424
  }
@@ -333,6 +333,29 @@ function alwaysOnReceiptLine(payload, updated) {
333
333
  if (!receipt)
334
334
  return null;
335
335
  const state = payload.isAlwaysOn ? 'on' : 'off';
336
+ const reply = updated && typeof updated === 'object' && !Array.isArray(updated)
337
+ ? updated
338
+ : null;
339
+ const command = reply?.controlCommand && typeof reply.controlCommand === 'object'
340
+ ? reply.controlCommand
341
+ : null;
342
+ const current = reply?.state && typeof reply.state === 'object'
343
+ ? reply.state
344
+ : null;
345
+ if (command?.enabled === payload.isAlwaysOn &&
346
+ typeof command.generation === 'number' &&
347
+ typeof command.supersededByGeneration === 'number' &&
348
+ typeof current?.isAlwaysOn === 'boolean') {
349
+ const action = receipt.unchanged.some((entry) => entry.field === 'isAlwaysOn')
350
+ ? `already ${state}`
351
+ : receipt.applied.some((entry) => entry.field === 'isAlwaysOn')
352
+ ? `turned ${state}`
353
+ : null;
354
+ if (action) {
355
+ return `Always-On: ${action} at generation ${command.generation}; ` +
356
+ `now ${current.isAlwaysOn ? 'on' : 'off'} at generation ${command.supersededByGeneration}.`;
357
+ }
358
+ }
336
359
  if (receipt.unchanged.some((entry) => entry.field === 'isAlwaysOn')) {
337
360
  return `Always-On: already ${state}; nothing changed.`;
338
361
  }
@@ -83,6 +83,11 @@ export interface PlanProactiveAgentResponse {
83
83
  spec: ProactiveAgentSpec | null;
84
84
  message: string;
85
85
  needsRefinement: boolean;
86
+ failure?: {
87
+ code: string;
88
+ retryable: boolean;
89
+ billingOwnerType: string | null;
90
+ };
86
91
  droppedWatchers?: string[];
87
92
  usage?: {
88
93
  inputTokens: number;
@@ -121,7 +126,21 @@ export interface ApplyProactiveAgentResponse {
121
126
  ok: boolean;
122
127
  status?: string;
123
128
  code?: string;
129
+ scheduleNotice?: string;
130
+ schedules?: Array<{
131
+ kind: string;
132
+ triggerId: string | null;
133
+ enabled: boolean | null;
134
+ reason?: string;
135
+ }>;
124
136
  };
137
+ defaultWatchers?: Array<{
138
+ source: string;
139
+ ok: boolean;
140
+ triggerId?: string | null;
141
+ enabled?: boolean | null;
142
+ code?: string;
143
+ }>;
125
144
  commitments?: Array<{
126
145
  id: string;
127
146
  title?: string;
@@ -147,6 +166,8 @@ export interface ApplyProactiveAgentResponse {
147
166
  id?: string;
148
167
  ok: boolean;
149
168
  code?: string;
169
+ enabled?: boolean | null;
170
+ firedAt?: string;
150
171
  }>;
151
172
  };
152
173
  };
@@ -241,6 +262,7 @@ export declare const proactiveApi: {
241
262
  }) => Promise<ApplyProactiveAgentResponse>;
242
263
  /** Meta-agent path: plan and persist a reviewable recommendation. */
243
264
  planProactiveAgentRecommendation: (body: {
265
+ name?: string;
244
266
  sentence?: string;
245
267
  history?: Array<{
246
268
  role: "user" | "assistant";
@@ -143533,5 +143533,5 @@
143533
143533
  ]
143534
143534
  }
143535
143535
  },
143536
- "version": "0.1.140"
143536
+ "version": "0.1.141"
143537
143537
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skrr-ai/cli",
3
- "version": "0.1.140",
3
+ "version": "0.1.141",
4
4
  "description": "Command-line interface for skrr",
5
5
  "license": "ISC",
6
6
  "author": "skrr",