@skrr-ai/cli 0.1.140 → 0.1.142

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,19 @@ 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
+ ? plan.failure.code === 'balance-exhausted'
266
+ ? 'Planning could not start. Review the billing guidance above.'
267
+ : 'Planning could not complete. Try again later.'
268
+ : 'Could not build a complete agent yet — refine the sentence and try again.', {
256
269
  exit: 1,
257
270
  });
258
271
  }
@@ -360,6 +373,25 @@ class AgentsSpawn extends base_command_1.BaseCommand {
360
373
  const o = result.installed.orchestrator;
361
374
  if (o) {
362
375
  this.log(` orchestrator: ${o.ok ? `installed${o.status ? ` (${o.status})` : ''}` : 'failed'}`);
376
+ if (o.scheduleNotice)
377
+ this.log(` ${o.scheduleNotice}`);
378
+ for (const schedule of o.schedules || []) {
379
+ const state = !schedule.triggerId
380
+ ? 'not scheduled'
381
+ : schedule.enabled === null ? 'unknown' : schedule.enabled ? 'enabled' : 'disabled';
382
+ this.log(` ${schedule.kind}: ${state}` +
383
+ (schedule.triggerId ? ` (${schedule.triggerId})` : '') +
384
+ (schedule.reason ? ` — ${schedule.reason}` : ''));
385
+ }
386
+ if (o.schedules?.some((schedule) => schedule.triggerId)) {
387
+ this.log(` Preflight: ${this.config.bin} triggers preflight <trigger-id>`);
388
+ }
389
+ }
390
+ for (const watcher of result.installed.defaultWatchers || []) {
391
+ if (!watcher.ok)
392
+ continue;
393
+ const state = watcher.enabled == null ? 'unknown' : watcher.enabled ? 'enabled' : 'disabled';
394
+ this.log(` ${watcher.source}: ${state}` + (watcher.triggerId ? ` (${watcher.triggerId})` : ''));
363
395
  }
364
396
  if (result.warnings.length > 0) {
365
397
  this.log(' warnings:');
@@ -377,6 +409,8 @@ class AgentsSpawn extends base_command_1.BaseCommand {
377
409
  renderRecommendationResult(recommendation, plan, json) {
378
410
  if (json) {
379
411
  this.log(JSON.stringify({ plan, recommendation }, null, 2));
412
+ if (plan.failure)
413
+ this.exit(1);
380
414
  return;
381
415
  }
382
416
  if (!recommendation) {
@@ -384,7 +418,11 @@ class AgentsSpawn extends base_command_1.BaseCommand {
384
418
  if (plan.droppedWatchers && plan.droppedWatchers.length > 0) {
385
419
  this.log(`(ignored unknown sources: ${plan.droppedWatchers.join(', ')})`);
386
420
  }
387
- this.error('Recommendation was not created — refine the sentence and try again.', {
421
+ this.error(plan.failure
422
+ ? plan.failure.code === 'balance-exhausted'
423
+ ? 'Recommendation was not created because planning could not start. Review the billing guidance above.'
424
+ : 'Recommendation was not created because planning could not complete. Try again later.'
425
+ : 'Recommendation was not created — refine the sentence and try again.', {
388
426
  exit: 1,
389
427
  });
390
428
  }
@@ -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
  }
@@ -22,7 +22,7 @@ class SpacesHeartbeatsCreate extends base_command_1.BaseCommand {
22
22
  }),
23
23
  agent: core_1.Flags.string({ description: 'Agent ID (required unless set via --from-json)' }),
24
24
  frequency: core_1.Flags.string({
25
- description: 'How often it runs, as a ladder key: 1m, 2m, 5m, 10m, 15m, 30m, hourly, 2h, 4h, 8h, daily, 2d, 4d, weekly, 2w. Not a cron expression. The time of day is fixed by the key (daily is 09:00 in --timezone).',
25
+ description: 'How often it runs, as a ladder key: 30m, hourly, 2h, 4h, 8h, daily, 2d, 4d, weekly, 2w. The minimum is 30 minutes. Not a cron expression. The time of day is fixed by the key (daily is 09:00 in --timezone).',
26
26
  }),
27
27
  prompt: core_1.Flags.string({ description: 'Prompt sent to the agent on each heartbeat' }),
28
28
  timezone: core_1.Flags.string({
@@ -22,7 +22,7 @@ class SpacesHeartbeatsUpdate extends base_command_1.BaseCommand {
22
22
  description: 'Path to a JSON file (or "-" for stdin) to use as the patch body',
23
23
  }),
24
24
  frequency: core_1.Flags.string({
25
- description: 'How often it runs, as a ladder key: 1m, 2m, 5m, 10m, 15m, 30m, hourly, 2h, 4h, 8h, daily, 2d, 4d, weekly, 2w. Not a cron expression. The time of day is fixed by the key (daily is 09:00 in --timezone).',
25
+ description: 'How often it runs, as a ladder key: 30m, hourly, 2h, 4h, 8h, daily, 2d, 4d, weekly, 2w. The minimum is 30 minutes. Not a cron expression. The time of day is fixed by the key (daily is 09:00 in --timezone).',
26
26
  }),
27
27
  prompt: core_1.Flags.string({ description: 'Prompt sent to the agent on each heartbeat' }),
28
28
  timezone: core_1.Flags.string({ description: 'Timezone the schedule runs in' }),
@@ -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 | null;
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";
@@ -93019,7 +93019,7 @@
93019
93019
  "type": "option"
93020
93020
  },
93021
93021
  "frequency": {
93022
- "description": "How often it runs, as a ladder key: 1m, 2m, 5m, 10m, 15m, 30m, hourly, 2h, 4h, 8h, daily, 2d, 4d, weekly, 2w. Not a cron expression. The time of day is fixed by the key (daily is 09:00 in --timezone).",
93022
+ "description": "How often it runs, as a ladder key: 30m, hourly, 2h, 4h, 8h, daily, 2d, 4d, weekly, 2w. The minimum is 30 minutes. Not a cron expression. The time of day is fixed by the key (daily is 09:00 in --timezone).",
93023
93023
  "name": "frequency",
93024
93024
  "hasDynamicHelp": false,
93025
93025
  "multiple": false,
@@ -93398,7 +93398,7 @@
93398
93398
  "type": "option"
93399
93399
  },
93400
93400
  "frequency": {
93401
- "description": "How often it runs, as a ladder key: 1m, 2m, 5m, 10m, 15m, 30m, hourly, 2h, 4h, 8h, daily, 2d, 4d, weekly, 2w. Not a cron expression. The time of day is fixed by the key (daily is 09:00 in --timezone).",
93401
+ "description": "How often it runs, as a ladder key: 30m, hourly, 2h, 4h, 8h, daily, 2d, 4d, weekly, 2w. The minimum is 30 minutes. Not a cron expression. The time of day is fixed by the key (daily is 09:00 in --timezone).",
93402
93402
  "name": "frequency",
93403
93403
  "hasDynamicHelp": false,
93404
93404
  "multiple": false,
@@ -143533,5 +143533,5 @@
143533
143533
  ]
143534
143534
  }
143535
143535
  },
143536
- "version": "0.1.140"
143536
+ "version": "0.1.142"
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.142",
4
4
  "description": "Command-line interface for skrr",
5
5
  "license": "ISC",
6
6
  "author": "skrr",